其它基本扩展
在线手册:中文 英文
PHP手册

JavaScript Object Notation


其它基本扩展
在线手册:中文 英文
PHP手册
PHP手册 - N: JavaScript Object Notation

用户评论:

dfugi9488 at yahoo dot com (17-Mar-2012 07:25)

A note to the example by jitendra dot thakur2008 at gmail dot com

Since the first parameter in the success function is html, var html needs to be used in the success callback, not var data:

success: function(html){
  $("ul#update").append(html);

   alert(html);   
}

jitendra dot thakur2008 at gmail dot com (18-Nov-2011 10:24)

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