0
我有一个网站,其中在加载了一系列的职位得到显示, 这些都通过一个控制器发送到页面下面的回报:Laravel实时更新模型
return View::make('stream')->with($this->postStream());
postStream只是一个获取我所有的postModels(雄辩)
现在当页面加载时,我想追加所有新的职位,因为你加载页面而不刷新,现在这将发生在AJAX(我不认为这可以除此之外)
所以我写了下面:
setInterval(function() {
$.ajax({
url: 'stream',
type: 'post',
cache: false,
success: function(data) {
stream = data;
},
error: function() {
alert('Something went to wrong.Please Try again later...');
}
})
console.table(stream.posts);
;},1000 * 60); // every minute
这个GET帖子适量,但我不能让我的帖子的内容。显示在下面做一个console.table(stream.posts);
+-----------+--------------+------------------+------------+
| (index) | timestamps | incrementing | exists |
+-----------+--------------+------------------+------------+
| 0 | true | true | true |
| 1 | true | true | true |
| 2 | true | true | true |
+-----------+--------------+------------------+------------+
当我将如何能够得到这些我的数据?
哇,实际上是完美的,我需要什么,就这么简单但有效的! – Kiwi