warning Invalid JSON response when I use jsonp

warning Invalid JSON response when I use jsonp

gowrigowri 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

Answers

This discussion has been closed.