function doSomething() {
console.log( 'main: ' + codebook_onlinedb);
}
var x = getCodeBook();
doSomething();
____End of code____
In firebug console: http://oi61.tinypic.com/2u7m1r9.jpg
In firebug console I have two POST calls. First gives me a list of methods and second gives me correct response to my task but my JS function doSomething is performed in first POST. Why? Or how can I wait to correct response from second POST. Thanks.
I have JS client: In JS I have function: ----------------------Start code------------------- var codebook_onlinedb;
function getCodeBook() { jsonrpcclient = new jsonrpcphp('http://some.url/server.php', function() { jsonrpcclient.cCodeBook.getCodeBook("inout", function(jsonRpcObj) { codebook_onlinedb = $.map(jsonRpcObj.result, function(value, index) { return [value]; }); }); });
function doSomething() { console.log( 'main: ' + codebook_onlinedb); }
var x = getCodeBook(); doSomething();
____End of code____
In firebug console: http://oi61.tinypic.com/2u7m1r9.jpg In firebug console I have two POST calls. First gives me a list of methods and second gives me correct response to my task but my JS function doSomething is performed in first POST. Why? Or how can I wait to correct response from second POST. Thanks.