我有一个简单的jQuery Ajax表单提交。在提交我的PHP脚本回声的json_decode($结果)如何提取php返回的json数据并将其显示在列表中
这是我的AJAX脚本
<script>
$("#ajaxquery").live("submit" , function(){
// Intercept the form submission
var formdata = $(this).serialize(); // Serialize all form data
// Post data to your PHP processing script
$.get("getdata.php", formdata, function(data) {
// Act upon the data returned, setting it to #success <div>
$("#success").html (data);
});
return false; // Prevent the form from actually submitting
});
</script>
的问题是,数据显示在JSON格式。
目前我的输出是这样的:
[{"id":4,"comments":1,"likes":15,"books":3,"name":"steve"}]
我怎样才能在列表中显示的数据: -
<ul>
<li>id</li>
<li>name</li>
<ul>
或者是有没有办法在一个变量来获得这些价值?
喜,但我怎么通过这个数据“$(”#成功“)。HTML(数据)”到PHP。我猜(数据)包含所有的信息 – 2013-03-25 11:23:49