Skip to content

Commit

Permalink
use $.ajax's timeout for the fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
defunkt committed Mar 24, 2011
1 parent c04c600 commit 1465668
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions jquery.pjax.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ jQuery.pjax = function( options ) {
var $ = jQuery, $container = $(options.container)

var defaults = {
timeout: 400,
push: true,
replace: false,
type: 'GET',
Expand Down Expand Up @@ -120,15 +121,6 @@ jQuery.pjax = function( options ) {
options = $.extend(true, {}, defaults, options)
var xhr = $.ajax(options)

// If we haven't found what we're looking for after a buncha ms
// we give up.
setTimeout(function(){
if ( xhr.readyState != 4 ) {
xhr.abort()
window.location = options.url
}
}, 400)

$(document).trigger('pjax', xhr, options)
return xhr
}
Expand Down

0 comments on commit 1465668

Please sign in to comment.