I hope you can help me to find a better title...
I have a php file the return a value:
<?php
$value= "abcd";
$returned= json_encode($value);
print_r($returned);
?>
I got that value with ajax
in my javascript file.
success: function (result) {
$sku= result;
console.log($sku);
}
Why in console.log()
is print
"abcd"
and not
abcd
if in javascript i have console.log("abcd");
it print only abcd
without quote.
From your question I think, following will resolve the concern.
<?php
$value= "abcd";
echo json_encode($value);
?>
javascript File
success: function (result) {
let sku = result;
console.log(sku);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.