开发者

Jquery ajax request fails on chrome

开发者 https://www.devze.com 2023-03-15 16:38 出处:网络
i have to make an ajax request to a PHP file to update the database. The PHP file should be called when i click on a link. Here\'s the jquery code i use:

i have to make an ajax request to a PHP file to update the database. The PHP file should be called when i click on a link. Here's the jquery code i use:

$("a#e开发者_如何学运维mail_contatti").click(function(){
   $.get("/segna_mail.php",{sito:'mywebsite'});
});

It works fine on Firefox 4/5 and Safari..But Chrome ( v14.0.797.0 but it does not work also on other versions) seems to cut the request and it does not update the db.. I tried also to access the PHP script via url and there it works fine also on Chrome.. Someone told me to add the return false at the end of the function. Tried also this but it breaks the link ( it's a mailto link ). I have no more ideas..

Thanks, Andrea


GET is meant to perform an operation that retrieves data, POST is meant to send data to a server (and most probably do something with it, like a database INSERT). So I imagine that Chrome may be cutting off / not sending the JSON data you're providing.

From what I take of what you're trying to do, it's better for you to use POST anyway. Try it out if that works.

If you really want to try it out with GET, try $.get('/segna_mail.php?sito=mywebsite') instead.

0

精彩评论

暂无评论...
验证码 换一张
取 消