• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

128
Views
JSONP get status reponse

I use an ajax request to fetch data from an api. Due to CORS issues, I have to request JSONP as dataType. Now I want to provide some information about validation errors to the users, which comes from the endpoint.

$.ajax({
        url: patBaseUrl,
        type: "GET",
        crossDomain: true,
        data: { apikey:  patBaseToken, query: query},
        dataType : 'jsonp',
        contentType: "application/javascript",
        xhrFields: {
          withCredentials: true
      },
        success: function(response) {
            addAlert('success', '<b>Success!</b> Query was sent successfully!');
        },
        error: function(xhr) {
            addAlert('warning', '<b>Warning!</b> Something went wrong: ' + xhr.status + ' ' + xhr.statusText);
            console.log(xhr.status, xhr.statusText);
        }

In the console I get for e.g. GET.... 404 Missing-Query How do I get the text Missing-Query?

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

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error