Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
130
rated 0 times [  134] [ 4]  / answers: 1 / hits: 17231  / 7 Years ago, mon, january 30, 2017, 12:00:00

When I am trying to get response from my API I am getting JSON.parse: unexpected end of data at line 1 column 1 of the JSON data this error in Mozilla Firefox Browser but not in Chrome browser.



            $.ajax({
dataType: 'json',
url: myApiUrl,
data: data,
type: 'post',
success: function(result)
{ alert(success);}
});


Note : assume that myApiUrl variable contains my url and
data contains my parameters.



Following is my Json Response



{type:Sale,status:1,transaction_id:T4U_122a668896_4bdadcc57,ErrorMSG:Success,ErrorCode:00,passive_data:####aaaa,total:10.47,time:31-01-2017 09:56:55}


How should I overcome that problem?


More From » php

 Answers
36

Use type: 'POST'. If it still doesn't work, try using async: false


[#59155] Friday, January 27, 2017, 7 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jonathoncamrynv

Total Points: 339
Total Questions: 98
Total Answers: 98

Location: Saint Vincent and the Grenadines
Member since Thu, Oct 15, 2020
4 Years ago
;