JQuery refuses to understand json format.
-
Example: There's a file.js and .php
The file says approximately:
$.ajax({ url:"index.php", datatype:"json", success:function(result){ console.info(result); } });
In file .php,
$array = array("object1" => "Boat","object2" => "Car","object3" => "Ship"); echo json_encode($array);
P.S If in file .js, in part of the success block, write this:
$objectJson = JSON.parse(result)
Then json's line would turn into json object, so I had the point.datatype: "json"
? ?
-
dataType:"json"
T is a big letter.