我需要CakePHP中的一個函數1.3要呈現jQuery函數使用的值,但它總是會在打破jquery的值之前呈現三個新行。設置這些headers
並沒有幫助在CakePHP中渲染任何東西之前,有三條新線斷行ajax
header("Pragma: no-cache");
header("Cache-Control: no-store, no-cache, max-age=0, must-revalidate");
header('Content-Type: text/x-json');
header("X-JSON: ".$content);
echo $content;
的jQuery使用:
var content = $.ajax({ url: /link/to/cakephp/function ,async: false }).responseText;
我能解決這些三線或jQuery的功能?
你在視圖中是否有'$ this-> layout ='ajax''? – petervaz
已經嘗試過'$ this-> autoRender = false;'或 \t \t'$ this-> layout ='ajax';'當'autoRender'設置爲'false'時,我只顯示控制器中的值,如果爲true我發表看法。但是不管在渲染視圖/值之前我總是得到3個空行 –