javascript - pass custom parameters to ajax request and get back the same in response -
i make series of asynchronous ajax calls , response dumped textfile. if want identify responses got ajax calls in file, don't have unique identifier. there way send custom parameter in ajax call , same on response call made unique ajax request?
$.ajax({ type: "post", url: posturl, // location of service data: postdata, //data sent server contenttype: "application/json", // content type sent server crossdomain: true, async: true, password : attr, success: function(data,success) { } });
so, using code snippet above, without moving it's own function, can this
... ... inputidentifer = 'this sort of identifying value'; (function(identifier) { $.ajax({ type: "post", url: posturl, // location of service data: postdata, //data sent server contenttype: "application/json", // content type sent server crossdomain: true, async: true, password: attr, success: function(data, success) { console.log(identifier); } }); }(inputidentifier)); ... ...
you'll see success function has identifier
Comments
Post a Comment