【发布时间】:2013-12-09 02:08:29
【问题描述】:
基本上我正在尝试使用这个 ajax 制作一个弹出窗口:
$.ajax({
type: 'GET'
url: 'news/read'
dataType: 'json'
cache: false
timeout: 10000
}).done (msg) ->
$("article#pop-read").empty().html msg.view
processing = false
window.history.pushState
path: msg.url
, "", msg.url
false
我正在返回一个视图值,它的 url 是这样的:
$data = json_encode(array(
'view' => View::make('layouts.read'),
'url' => 'news/read/2013/11/24/test-title-seperate-with-dash'
));
return $data;
这一切都很好,除了我无法从 laravel 获取视图值(它在 javascript 中返回 Object object)。但是如果我像return View::make('layouts.read') 那样直接写它,它会很好地返回。这是为什么呢?
另外(不必回答,不是主要问题),当我使用pushState 时,我的浏览器上的后退按钮不起作用,这是一个错误吗?
【问题讨论】:
标签: php jquery ajax json laravel