I'm building a web app using Laravel 4. Nearly all links on my site load content via jQuery AJAX. However when I'm building, and Laravel throws an error, the error page doesn't get displayed in my target area. So I end up disabling AJAX most of the time so I can see the errors thrown by Laravel.
Is there something I can change with my AJAX loader that would display the Laravel errors?
function LoadContent( url, target, method, data )
{
$(target).fadeOut(20);
var loadingTimeout = setTimeout(function() { $(target).html('<div style="text-align:center;font-size:150%;">Loading ...</div>').fadeIn(200); }, 1000);
var request = $.ajax({ url: url, type: method, data: data });
var tooLongTimeout = setTimeout(function() { request.abort(); request = false; $(target).html('<div class="large-9 large-centered columns"><h1>Request Failed</h1><p>Please try again or contact us to report the issue.</p></div>').fadeIn(200); }, 60000);
request.done( function(result) {
clearTimeout(loadingTimeout);
clearTimeout(tooLongTimeout);
$(target).html(result).fadeIn(50);
AjaxElements();
});
}