jQuery's getScript function, wait for the retrieved variable -


i have jquery getscript function:

jquery.getscript(script,function() {     src = an_ajax_request; }); 

the problem is, need variable outside function, make string:

if(src == "") string = "string"+src; //i empty src value here! 

but if getscript function takes longer load (loading async), src value in console, src still empty when try build string.

question: how can make string generation wait src value retrieved getscript function?

in ajax request, this.

$.ajax({   url: "getsrc",   success: function(src){    string = "string"+src;   } }); 

Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -