0
你好,我有被利用$.ajax()
最终的结果称为PHP的方法是我返回类似json_encode($insert)
的东西,对ajax调用是成功的我提醒返回数据,并得到如下的成功,jQuery的AJAX JSON帮助
{"content":"Helle this is a testasdasdasdsd","retrain":false,"created_at":1296247015,"employers_id":"4"}
然后我尽量缩小我展示做这个html.content
但是这将返回时,我提醒为未定义的数据,下面是我的代码
的Javascript:
$('#employer_feed').submit(function(){
$.ajax({
url: '/employer/feed',
data: $('#employer_feed').serialize(),
type: 'POST',
success:function(html) {
alert(html);
$('#feed').append('<div class="feed_item">'+html.content+'</div>');
}
});
return false;
});
PHP:
if($this->f->insert($insert)) {
if(is_ajax()) {
echo json_encode($insert);
}
}
这是$插入的样子,
Array ( [content] => Helle this is a testasdasdasdsd [retrain] => [created_at] => 1296247448 [employers_id] => 4 )
你能告诉我们什么$插入看起来像? – 2011-01-28 20:42:37