简体   繁体   中英

jQuery .done() not firing on $.post

I have the following sentence:

var token = 'token';

$.post("/signup.php", {token: token}).done(function(data) {
    alert("done");
});

This actually doesn't works, and I honestly don't know why, because it's so simply... I have jQuery 1.11.1, and "signup.php" takes up to 10 seconds to be completed and return a success answer. It's possible it's not working due the time signup.php takes to be processed?

Thank you guys

try adding timeout attribute, since the result is taking too much time. Also, I feel that token should be in headers attribute.

$.post("/signup.php", {headers: {token: token}, timeout : 20000}).done(function(data) {
    alert("done");
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM