<meta name="_token" content="{{ csrf_token() }}"/>
$.ajax({
type: "POST",
async: true,
url: "/page",
headers: { 'X-CSRF-Token' : $('meta[name=_token]').attr('content') },
success: function(html) {
$("#results").append(html);
});
routes.php文件
Route::post('/page', function () {
$cont = Content::orderby('pscore','DESC')->take(3)->get();
return View::make('content.moreContent')->with('cont',$cont);
});
这个对我有用,但是如果我调用控制器就会抛出错误 500(内部服务器错误)
控制器
public function more()
{
$cont = Content::orderby('pscore','DESC')->take(3)->get();
return View::make('content.moreContent')->with('cont',$cont);
}