Global variable is not showing result inside a ajax call <p>Here index is a global variable. I am manipulating the index in another function.</p> <p>after that I call this function. its showing the actual result outside and after the ajax call but not showing inside the ajax call. </p> <pre><code>var urlSearch = "http://192.168.10.113/collective-intellegence/UserClickPersonClassifier?userid=1&amp;query=asp.net"; alert(index); $.ajax({ url: urlSearch, type: 'POST', dataType: 'json', success: function (data) { alert(index); } }); </code></pre> <p>Is there any mistake done by me.</p> <p>Please help to solve this problem.</p> <p>Thanks in advance.</p>