Laravel 4 Ajax check to include XMLHttpRequest (from Magnific Popup)
问题 Using the code from this question, @extends('layouts.' . isset($ajax) ? 'ajax' : 'master') to check for Ajax. It works for regular Ajax page loads but not when using a popup. In this case I'm using Magnific Popup's Ajax mode, the request header is XMLHttpRequest but Laravel returns the non-ajax (extended) layout. 回答1: First of all I don't know how the $ajax variable is being set( isset($ajax) ), but the right way to check for an ajax request in Laravel is if(Request::ajax()) { // ... } Or,