My code :
function send() {
var nop = 6;
var send_this = {
nop: nop
};
$.ajax({
type: "GET",
data: send_this,
url: "example.com",
success: function(r) {
var obj = JSON.parse(r);
nop = obj.nopval;
/* some other stuffs*/
}
)
};
}
Now, since I already set the nop
to 6 , it will pass 6. But on returning, the json response obj.nopval
will return 12 which I want to set to nop
. So that next time it sends 12 and return 18 and so on....
What happening here is , it is sending 6 and returning 12 but sending 6 again and returning 12 again. The variable is not getting updated.