Here index is a global variable.
I am manipulating the index in another function.
after that I call this function.
its showing the actual result outside and after the ajax call but not showing inside the ajax call.
var urlSearch = "http://192.168.10.113/collective-intellegence/UserClickPersonClassifier?userid=1&query=asp.net";
alert(index);
$.ajax({
url: urlSearch,
type: 'POST',
dataType: 'json',
success: function (data) {
alert(index);
}
});
Is there any mistake done by me.
Please help to solve this problem.
Thanks in advance.
Make sure the ajax request success. You can try adding an
alert('a');beforealert(index);If it is entering in success, then you should make sure the function that handles
indexglobal variable doesn’t fire after you make the ajax request and before you get the response. I’d add in that function an alert that says something like “Changed from XX to YY”