Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

184
Views
JQuery $.post() callback failure

Here's my JavaScript Code:

$.post("Actions.php", {
    'recaptcha': grecaptcha.getResponse(),
    'email': $("#emailInput").val(),
    'Password': $("#passwordConfirm").val(),
},
function(data) {
    console.log(data);
})

Now the post request was successfully executed, but console.log(data)was ignored by JQuery. I tried to search for any possible errors from the documents,but nothing found. Anything wrong with my code? Thanks.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

When providing a success, JQuery probably parses your POST data/body object as its settings object instead

It should work if you move the callback to a .done

edit: mis-read the jQuery.post documentation, ignore the above

Try adding a handler for both done and fail:

$.post("Actions.php", {
    'recaptcha': grecaptcha.getResponse(),
    'email': $("#emailInput").val(),
    'Password': $("#passwordConfirm").val(),
})
.done(function(data, textStatus, jqXHR) {
    console.log("Success ", data);
})
.fail(function(data, textStatus, jqXHR) {
    console.log("Failed ", textStatus);
});

.done is run on a 'successful' response, .fail for failure responses, and .always for any response

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!