For the following code getting output
$response=array();
$response['wheel_deg_end'] = (360*(ceil($wheel->wheel_spin_time/3))) + (360 - (($wheel_slice_number * 30) - 30)) + rand(-5,5);
$response['wheel_time_end'] = $wheel->wheel_spin_time * 1000;
$response['success'] = true;
$ab = json_encode($response,JSON_NUMERIC_CHECK);
echo $ab;
Output:
"{"wheel_deg_end":1743,"wheel_time_end":10000,"success":true}"
and error in Json parse:
jQuery.ajax({
url: couponspining_ajaxurl,
type: 'POST',
data: {
action: 'couponspining_wheel_run',
form_data: form_data,
preview_key: this.preview_key
},
context: this,
}).done(function(json){
this.submit_form_done(jQuery.parseJSON(json));
});
Uncaught SyntaxError: JSON.parse: unexpected character at line 3 column 1 of the JSON data submit_form http://localhost/shopify-php-app/src/public/assets/js/couponspining1.js:210
from Getting error: Uncaught SyntaxError: JSON.parse: unexpected character at line 3 column 1 of the JSON data - In this almost valid code
No comments:
Post a Comment