JSON is used where we want send data as an object its either be an array or string.
jquery and php json example
var dataString = 'comment=' + comment;
$.ajax({
type: "POST",
url: "pagepostbyajax.php",
//this data is mendetory when u want post data when posting page by ajax.
//after that ur data send to that page. now in backend page echo json data.if your //data is in array format the use json_encode() function then echo that json data
//now you find tht json in your success that can you use by taking a loop.
data: dataString,
cache: false,
datatype: json,
success: function(html){
$("ul#update").append(datal);
alert(data);
}
});
Regards Jitendra Thakur
JavaScript Object Notation
- 導入
- インストール/設定
- 定義済み定数
- JsonSerializable — JsonSerializable クラス
- JsonSerializable::jsonSerialize — JSON にシリアライズしたいデータを指定する
- JSON 関数
- json_decode — JSON 文字列をデコードする
- json_encode — 値を JSON 形式にして返す
- json_last_error — 直近に発生したエラーを返す
jitendra dot thakur2008 at gmail dot com
18-Nov-2011 02:24
