|
Title: JavaScript question Post by: ClSoft on January 26, 2013, 03:45:03 PM Hi all
I'm working with combination of few programming languages and here is my problem: I need to execute some code from JavaScript, fill some variable in other language (string) and when variable is filled, goes back to JavaScript and continue to execute JavaScript. Now, it does not work on that way because JavaScript does not wait and check if variable is filled. My JavaScript code is this: Code: function loadlocal() Title: Re: JavaScript question Post by: Ellipsis on January 27, 2013, 12:20:22 AM Try the jquery done()
You use It to trigger an action when an Ajax call is finished. Your submit should trigger a post action (var ajaxcall = jquery.ajax(.......);) You can 'monitor' the ajaxcall with jquery.when(ajaxcall).done(function(){.....}); See the examples on the jquery website. You can even push multiple ajaxcalls into an array And monitor the entire array. Title: Re: JavaScript question Post by: ClSoft on January 27, 2013, 03:37:03 PM Hi
thanks, but I don't know how to implement it. I saw jQuery examples but they work with JavaScript. I have some variable from external software (like VB). I meant to go to other direction, like this: when user click on button, JavaScript function is fired and it calls some hidden webpage (page2). There my external application start to fill the variable (some big string). Now I meant not to go back to JavaScript, but instead, I meant to run the code form page2 and that code should be executed on page1. When my variable is filled, I need to run something like this (from page2): Code: var rows = []; and myFilledVariable contains something like this: Code: rows.push({{id: 'aaa',value: 'val1'});this code should be executed on page1 (#tt datagrid is located on page1). on that way I must not wait on page1 until my variable is filled, instead I'm going to fill it and when it is finished, I display result on first page. Is that possible, and if yes - how? Thanks. Update: Is there any other way to call such code from page2 and which will load data on page1 (on #tt grid) : $('#tt').datagrid('loadData', rows); Thanks! |