warning Invalid JSON response when I use jsonp
warning Invalid JSON response when I use jsonp
 gowri            
            
                Posts: 7Questions: 1Answers: 0
gowri            
            
                Posts: 7Questions: 1Answers: 0            
            I am getting this error DataTables warning: table id={id} - Invalid JSON response, when I am accessing json source from different server. I am using jsonp "dataType": "jsonp", on request.  This error is explained here http://datatables.net/manual/tech-notes/1
Code
        $('#UsersTable').DataTable({
            "processing": true,
            "ajax": {
                "url": 'http://rootaccez.com/demo/source.json',
                "dataType": "jsonp",
            },      
            "columns": [
                        { "data": "username" },
                        { "data": "email_id" }
                       ]
        }); 
response
{
    "data": [
        {
            "username": "example",
            "email_id": "example@yahoo.com"
        },
        {
            "username": "test",
            "email_id": "test@gmail.com"
        }
    ]
}
But When I am access the same response from the same localhost, It works well.
Local working config
            "ajax": {
                "url": 'http://locahost.com/source.json',
              
            }
So I am confused. Can someone help to find the issue.
This question has an accepted answers - jump to answer
This discussion has been closed.
            
Answers
What does your browser's console info say?
Hey tangerine,
request :
http://rootaccez.com/demo/source.json?callback=jQuery110209406516835744307_1413453761013&_=1413453761014
response :
Sorry about the CDATA stuff in your pastes above - that is cloud flare trying to protect e-mail addressees...
Regarding your issue. The server is responding with valid JSON, not JSONP. There is no function call there.
Allan
Thanks Allan, It works now :)