• Home
  • Jobs
  • Courses
  • Questions
  • Teachers
  • For business
  • ES/EN

0

21
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 1 month ago ·

Juan Pablo Isaza

Answer question
Find remote jobs
Loading

Discover the new way to find a job!

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