How can i send json data from php to javascript?
To send JSON data from PHP to JavaScript, you need to use the json_encode()
function.
Example:
$data = array('name' => 'John', 'age' => 30);
echo json_encode($data);
To send JSON data from PHP to JavaScript, you need to use the Example:How can i send json data from php to javascript?
json_encode()
function.
$data = array('name' => 'John', 'age' => 30);
echo json_encode($data);