How I can make this:
$.ajax({
type: "POST",
url: "",
data: dataString,
cache: false,
success: function(html){}
});
but datatype json
and using it by php
please tell me an example because i tired to search in the internet
How I can make this:
$.ajax({
type: "POST",
url: "",
data: dataString,
cache: false,
success: function(html){}
});
but datatype json
and using it by php
please tell me an example because i tired to search in the internet
Use the dataType
property to have a JSON response parsed into a native object:
$.ajax({
type: "POST",
url: "",
data: dataString,
dataType: "json",
cache: false,
success: function(html){}
});
If you're trying to post JSON data to the server, you will need json2.js to convert your object into a JSON string before posting it:
data: { json: JSON.stringify(someObj); }
and in php >=5.2:
$data = json_decode($_POST['json']);