Click here to Skip to main content
15,903,741 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
There is REST API, from which I am trying to fetch response.
Issue is if I use JSONP to overcome cross-domain issue then I get error_code:1000 in console.
This is the response I get in console:

Object {header: Object, body: Object}
body:Object
error_code:1000
__proto__:Object
header:Object
__proto__:Object

This is my AJAX call looks like

JavaScript
$.ajax({
        type: 'GET',
        url: 'for security reason I cannot display API URL',
        dataType: 'jsonp',
        data: {
            authtoken: AppFramework.constants.AUTHTOKEN
        },
        success: function(result) {
            console.log(result) ;

        }
    });
};


Is this a whitelisting issue? I am unable to identify. Please suggest.

What I have tried:

When I use data type as JSON, it gives cross domain error.
I get below error.

XMLHttpRequest cannot load https://www.site24x7.com/api/reports/availability_summary?period=3&authtoken=2f8671565a3cbb9e44b858160355ad7c. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:59185' is therefore not allowed access.
Posted
Comments
Richard Deeming 26-Jul-16 8:33am    
Does that API support JSONP? It's something that has to be explicitly enabled on the server, not something that can be added by jQuery.

Try using Firefox, Chrome, or Fiddler to log the network request and response to see what's being returned.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900