Uncaught SyntaxError: Unexpected identifier while calling JSONP
up vote
1
down vote
favorite
My problem with CORS, Cross origin, we search from google and found solution with JSONP, but we recieve error while calling API throught JSONP, below mycode.
$.ajax(
type: 'POST',
url: 'myapi',
data: login:login,key:key,action:action, format:'jsonp',
dataType: "jsonp",
jsonpCallback: "jsonp_callback",
crossDomain: true,
success : function(response)
alert(response);
,
error: function(result)
alert('error');
);
function jsonp_callback(json)
alert(json);
Uncaught SyntaxError: Unexpected identifier
please help me and thanks in advance.
javascript php json ajax jsonp
|
show 1 more comment
up vote
1
down vote
favorite
My problem with CORS, Cross origin, we search from google and found solution with JSONP, but we recieve error while calling API throught JSONP, below mycode.
$.ajax(
type: 'POST',
url: 'myapi',
data: login:login,key:key,action:action, format:'jsonp',
dataType: "jsonp",
jsonpCallback: "jsonp_callback",
crossDomain: true,
success : function(response)
alert(response);
,
error: function(result)
alert('error');
);
function jsonp_callback(json)
alert(json);
Uncaught SyntaxError: Unexpected identifier
please help me and thanks in advance.
javascript php json ajax jsonp
1
please can you show the data you're downloading? Whatever it is, it's not what jquery was expecting
– ADyson
Nov 10 at 12:20
It looks like your JSON is not valid.
– mx0
Nov 10 at 12:26
response return plain text format.
– Arsalan khatri
Nov 10 at 12:28
please see attached snapshot of my data.
– Arsalan khatri
Nov 10 at 12:29
Please send server side code used to handle this ajax call.
– Kamran Syed
Nov 10 at 12:52
|
show 1 more comment
up vote
1
down vote
favorite
up vote
1
down vote
favorite
My problem with CORS, Cross origin, we search from google and found solution with JSONP, but we recieve error while calling API throught JSONP, below mycode.
$.ajax(
type: 'POST',
url: 'myapi',
data: login:login,key:key,action:action, format:'jsonp',
dataType: "jsonp",
jsonpCallback: "jsonp_callback",
crossDomain: true,
success : function(response)
alert(response);
,
error: function(result)
alert('error');
);
function jsonp_callback(json)
alert(json);
Uncaught SyntaxError: Unexpected identifier
please help me and thanks in advance.
javascript php json ajax jsonp
My problem with CORS, Cross origin, we search from google and found solution with JSONP, but we recieve error while calling API throught JSONP, below mycode.
$.ajax(
type: 'POST',
url: 'myapi',
data: login:login,key:key,action:action, format:'jsonp',
dataType: "jsonp",
jsonpCallback: "jsonp_callback",
crossDomain: true,
success : function(response)
alert(response);
,
error: function(result)
alert('error');
);
function jsonp_callback(json)
alert(json);
Uncaught SyntaxError: Unexpected identifier
please help me and thanks in advance.
javascript php json ajax jsonp
javascript php json ajax jsonp
edited Nov 10 at 12:21
ADyson
21.5k112441
21.5k112441
asked Nov 10 at 12:16
Arsalan khatri
63
63
1
please can you show the data you're downloading? Whatever it is, it's not what jquery was expecting
– ADyson
Nov 10 at 12:20
It looks like your JSON is not valid.
– mx0
Nov 10 at 12:26
response return plain text format.
– Arsalan khatri
Nov 10 at 12:28
please see attached snapshot of my data.
– Arsalan khatri
Nov 10 at 12:29
Please send server side code used to handle this ajax call.
– Kamran Syed
Nov 10 at 12:52
|
show 1 more comment
1
please can you show the data you're downloading? Whatever it is, it's not what jquery was expecting
– ADyson
Nov 10 at 12:20
It looks like your JSON is not valid.
– mx0
Nov 10 at 12:26
response return plain text format.
– Arsalan khatri
Nov 10 at 12:28
please see attached snapshot of my data.
– Arsalan khatri
Nov 10 at 12:29
Please send server side code used to handle this ajax call.
– Kamran Syed
Nov 10 at 12:52
1
1
please can you show the data you're downloading? Whatever it is, it's not what jquery was expecting
– ADyson
Nov 10 at 12:20
please can you show the data you're downloading? Whatever it is, it's not what jquery was expecting
– ADyson
Nov 10 at 12:20
It looks like your JSON is not valid.
– mx0
Nov 10 at 12:26
It looks like your JSON is not valid.
– mx0
Nov 10 at 12:26
response return plain text format.
– Arsalan khatri
Nov 10 at 12:28
response return plain text format.
– Arsalan khatri
Nov 10 at 12:28
please see attached snapshot of my data.
– Arsalan khatri
Nov 10 at 12:29
please see attached snapshot of my data.
– Arsalan khatri
Nov 10 at 12:29
Please send server side code used to handle this ajax call.
– Kamran Syed
Nov 10 at 12:52
Please send server side code used to handle this ajax call.
– Kamran Syed
Nov 10 at 12:52
|
show 1 more comment
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53238862%2funcaught-syntaxerror-unexpected-identifier-while-calling-jsonp%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
please can you show the data you're downloading? Whatever it is, it's not what jquery was expecting
– ADyson
Nov 10 at 12:20
It looks like your JSON is not valid.
– mx0
Nov 10 at 12:26
response return plain text format.
– Arsalan khatri
Nov 10 at 12:28
please see attached snapshot of my data.
– Arsalan khatri
Nov 10 at 12:29
Please send server side code used to handle this ajax call.
– Kamran Syed
Nov 10 at 12:52