Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php return a json response

//PHP File
<?php
$data = /** whatever your data are **/;
header('Content-Type: application/json; charset=utf-8');
echo json_encode($data);

//In JS File
//JQUERY AJAX
        $.ajax({
        url: "path/to_php_file.php",
        dataType: "json",  
        type: "GET",
        data: {datax : datax },
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #php #return #json #response
ADD COMMENT
Topic
Name
8+2 =