<a id="ad_server_ad" name="1" href="http://google.com">
<img src="xyz.png"></a>
Above is my html code:
This is my js code :
$(document).ready(function(){
$('a#ad_server_ad').click(function() {
var name = this.name;
$.post("ajax_test.php",{ test:name },function(data){
alert(data);
});
});});
And this is my ajax_test.php
if(isset($_REQUEST['test']))
{
echo "Call made successfully" . $_REQUEST['test'];
}
The code works perfectly fine for the first ajax call but after that when I open the page again and click on the image once more the ajax call is cancelled as shown in networks/XHR. If I wait for a few mins it works again but just for once.
Now if I use the same code in Incognito mode it works for all the consecutive click. I am new to ajax and jquery so help me.