php - Pass a variable from a get query in javascript -


i trying pass value of parameter outside $.get jquery in javascript. read should somehow in synchronous mode couldn't find solution.

here code:

var flag; var t = $.get("mutalyzer.php?id="+variation.value, function(data) {     flag=data; }); document.write(flag); 

where undefined result.

thanks!

write inside callback function

try this

var t = $.get("mutalyzer.php?id="+variation.value, function(data) {    //this callback function , runs when gets  completed    flag=data;    document.write(flag);   }); 

Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -