Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery $.get returns white error page when handling errors
    text
    copied!<p>The following code gives me an error like <a href="http://cl.ly/image/1s2b1r1r2A1r" rel="nofollow">this</a> when I request a page and it comes back 404. Instead it should bring up an alert. What is strange is it <strong>only does this on links that have been ajaxed in</strong>, on links that don't update/change it works fine.</p> <pre><code>('.page-wrap').append('&lt;img src="img/graphics/ajax-loader.gif" class="ajax-loader" /&gt;'); var target = $('section.content'), siteURL = 'http://' + top.location.host.toString(), internalLinks = $("a[href^='"+siteURL+"'], a[href^='/'], a[href^='./'], a[href^='../'], a[href^='#']"), links = $('a'), URL, el, mainContent, headContent, headClasses, pageName, ajaxSpinner = $('.ajax-loader'); internalLinks.click(function(e) { el = $(this); URL = el.attr('href'); $('.current_page_item').removeClass('current_page_item'); el.addClass("current_link").parent().addClass("current_page_item"); ajaxLoader(URL, false); e.preventDefault(); }); function ajaxLoader(location, isHistory) { $("html, body").animate({ scrollTop: "0px" }); ajaxSpinner.show(); $('.page-wrap').css('opacity', '0.5}'); // Load New Page $.get(location, function(data) { mainContent = $('section.content', data).html(); headContent = $('.feature-content', data).html(); pageName = $('.page-name', data).html(); headClasses = $('header', data).attr('class'); $('section.content').html(mainContent); $('.page-name').html(pageName); $('.feature-content').html(headContent); if (headClasses) { $('header').attr('class', headClasses); } else { $('header').removeClass(); } if (!isHistory) { history.pushState(location, '', location); } $(resizeHeader); ajaxSpinner.fadeOut(); }).error(function() { alert('woops'); // or whatever }); } w.bind('popstate', function(event) { if (event.originalEvent.state !== null ) { ajaxLoader(event.originalEvent.state, true); } }); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload