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

178
Views
Why WordPress ajax call is showing bad request (0)

I am trying to upload files ( image, video, and zip ) from the front-end using jQuery Ajax call.

Here is the jQuery code:

$(document).on("submit", "#add_training_video", function (e) {
  e.preventDefault();
  var form = $(this);
  var actionUrl = handle.ajaxurl;
  var data = new FormData(this);

  $.ajax({
    dataType: "html",
    type: "POST",
    url: actionUrl,
    data: data,
    processData: false,
    contentType: false,
    beforeSend: function () {
      $(".video-button").val("Please wait...");
      $(".video-button").prop("disabled", true);
    },
    success: function (data) {
      $(".video-button").val("Add A New Video");
      $(".video-button").prop("disabled", false);
      $(".ajax_response").html(data);
      // console.log(data);
      // $(".ajax_response").html("");
      // if(!data.success) {
      //   data.message.forEach(function(key, ele){
      //     $(".ajax_response").append("<div class='error-message'>" + key +"</div>");
      //   });
      // } else {
      //   $(".ajax_response").append("<div class='success-message'>" + data.message +"</div>");
      // }
    },
  });
});

Now, If I upload a file that is more than 5 MB then I am getting a 0 or Bad Request from ajax response.

Can you tell me why?

Thank You!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Your server has POST file size limit with 5mb (default conf).

Edit your php.ini config with lines:

post_max_size=20M
upload_max_filesize=20M
over 4 years ago · Santiago Trujillo 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!