Welcome Guest, Not a member yet? Register   Sign In
Controller can't return json data
#3

i wanted to implement https://demo.paypal.com/au/demo/download...2&lang=PHP
its is simple PHP solution(it working fine standalone)
i've load constants in my constants file and past the index.php code in my view file and also make a new controller.
when i make the
Error when i click the javascript paypal button
Uncaught SyntaxError: Unexpected token < in JSON at position 0

this error come from this code

return fetch(
'<?=URL['services']['orderCreate']?>',
{
method: 'POST',
body: formData
}
).then(function(response) {
return response.json(); ## PRBLEM with this line JSON return issue
// console.warn(xhr.response.json())
}).then(function(resJson) {
console.log('Order ID: '+ resJson.data.id);
return resJson.data.id;
});
},

i've mention above there is an issue in return response.json();
above plase tell how to get he response in json format.
in CI. i'm using CI 3.x.
Reply


Messages In This Thread
RE: Controller can't return json data - by T.O.M. - 10-14-2020, 11:17 PM
RE: Controller can't return json data - by waqaschughtai91 - 04-30-2021, 02:59 PM



Theme © iAndrew 2016 - Forum software by © MyBB