My CURL code is as follows:
$ch = curl_init("http://my ip address/api/FeedbackCustomerDetails?accessKey=$access_key&AccountNo=$subscriber_code");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec($ch);
$response = print stripslashes(json_encode($result));
The response from my curl is as follows:
"{"CENTER":"BRADFORD","STATUS":"0","SUB_NAME":"PETER ","ACCOUNT_NO":"HB92008117","ASSOCIATE_ID":"850N027","STATUS_TEXT":"SUCCESS","REGION":"UK"}"
Without strip_slashes the output is:
"{\"CENTER\":\"BRADFORD\",\"STATUS\":\"0\",\"SUB_NAME\":\"PETER \",\"ACCOUNT_NO\":\"HB92008117\",\"ASSOCIATE_ID\":\"850N027\",\"STATUS_TEXT\":\"SUCCESS\",\"REGION\":\"UK\"}"
I tried the following and always get "undefined"
success: function(response) {
alert(response.ACCOUNT_NO);
},
I need to display the data in a span id. I tried the following too:
$("#subscriber code").text(response[0].ACCOUNT_NO);
response.ACCOUNT_NO; always results in UNDEFINED.
What am i doing wrong?? Requesting help..