0

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?

mm1975
  • 1,583
  • 4
  • 30
  • 51

0 Answers0