Any ideas on why the following code perfectly ‘posts’ when using FF (I can see the DB updated) but fails on Chrome?
$("a").click(function() {
$.post("ajax/update_count.php", {site: 'http://mysite.com'});
});
Tip: jQuery version is jquery-1.4.3.min.js
Update
The issue seems to be that when the link is clicked, a new page is loaded, which seems to be stopping the post in Chrome… Is that a possible explanation? If so, what can I do?
You need to prevent the default behavior of an
<a>. Use this:or, if you actually want the link to load the new page, you could try:
Might have to change it a little – maybe use
$(this).attr("href")or$(this).prop("href"), notthis.href…the differences those evaluate to may or may not work withwindow.location.href(I’m sure both do).