开发者

Jquery $.Post works in Firefox but not Chrome

I'm using Jquery to pass POST data to PHP scripts, however the function only seems to work on Firefox and not function on chrome. Here is an example Jquery post for logging in开发者_运维知识库 that fails:

   $(document).ready(function() {
      $("#loginform").submit(function() {
         var username = $("#username").val();
         var password = $("#password").val();
         $.post("ex.php", { 
            username: username,
            password: password }, 
            function(data) {
               $("#response").hide().html(data).show('fade','fast' );
               });
            return false;
         });
      });

Instead of functioning like a proper AJAX request as it does in Firefox, it simply refreshes the page in Chrome.

Any ideas?

Thanks.


you are not sending the correct variables, maybe?

unameval: username ,
pwordval: password }, 

I mean you assign the values to username and password variables but never use them and send unameval and pwordval instead. If unameval is not defined, browser would err and not continue. Firefox may have the correct version you accidentally changed later on cache, so keeps working. Maybe, maybe...


I had a simple problem of not converting some post data .toString()

The code worked in some other browsers but not in chrome. HTH someone out there.


Chrome and jquery dont play nice in terms of POST. That's the short story. Try upgrading to the latest version of JQuery.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜