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

181
Views
Action returns Status Code 204 but, AJAX success function doesn't execute

My controller is correctly returning new HttpStatusCodeResult(204)(checked using debugging), but the success function is not triggered. I just want to reset a text field after I've submitted something.

Ajax:

$(document).ready(function () {
        $("#offersubmit").click(function (e) {
            $.validator.unobtrusive.parse($('offerForm'));
            if ($(this).valid()) {
                var valdata = $("#offerForm").serialize();
                $.ajax({
                    url: "/Product/MakeOffer",
                    type: "POST",
                    dataType: 'json',
                    contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
                    data: valdata,
                    success: $(document).ready(function () {
                        alert("AAA");
                        $('#offerText').val('');
                    })
                })
            }
        });
    });

Also tried with alert() and it didn't show anything. Any help would be appreciated

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

0

You need to remove the $(document).ready(.. code

success: $(document).ready(function () {
    alert("AAA");
    $('#offerText').val('');
})

should be

success: function(data) {
    alert("AAA");
    $('#offerText').val('');
}
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!