how to retrieve parameter from jquery post -


i'm retrieving parameters url jquery. there may more 1 parameter retrieve. take parameters , feed them 1 one $.post procedure. how retrieve parameter inside post code?

 var spageurl = window.location.search.substring(1);         var surlvariables = spageurl.split('&');          (var = 0; < surlvariables.length; i++)          {             $.post('php/get_victim.php', {name:surlvariables[i]}, function(output){                 //i want "name" variable inside here             });          } 

you can use closure , retain variable being looped over:

for (var = 0; < surlvariables.length; i++) {     (function(name) {         $.post('php/get_victim.php', {name:name}, function(output) {             //i want "name" variable inside here             console.log(name); //name above         });     })(surlvariables[i]) } 

Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -