Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
Navigation: Add parameter calculateOnly to getAjaxFormData when the d…
Browse files Browse the repository at this point in the history
…ata itself is not important
  • Loading branch information
Gabriel Schulhof committed Nov 27, 2012
1 parent e84cf61 commit 283c567
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions js/jquery.mobile.navigation.js
Expand Up @@ -1264,7 +1264,8 @@ define( [
//the following deferred is resolved in the init file
$.mobile.navreadyDeferred = $.Deferred();
$.mobile._registerInternalEvents = function() {
var getAjaxFormData = function( $this ) {
var getAjaxFormData = function( $this, calculateOnly ) {
var type, target, url, ret = true;
if ( !$.mobile.ajaxEnabled ||
// test that the form is, itself, ajax false
$this.is( ":jqmData(ajax='false')" ) ||
Expand All @@ -1274,9 +1275,8 @@ define( [
return false;
}

var type = $this.attr( "method" ),
target = $this.attr( "target" ),
url = $this.attr( "action" );
target = $this.attr( "target" );
url = $this.attr( "action" );

// If no action is specified, browsers default to using the
// URL of the document containing the form. Since we dynamically
Expand All @@ -1301,16 +1301,21 @@ define( [
return false;
}

return {
url: url,
options: {
type: type && type.length && type.toLowerCase() || "get",
data: $this.serialize(),
transition: $this.jqmData( "transition" ),
reverse: $this.jqmData( "direction" ) === "reverse",
reloadPage: true
}
};
if ( !calculateOnly ) {
type = $this.attr( "method" );
ret = {
url: url,
options: {
type: type && type.length && type.toLowerCase() || "get",
data: $this.serialize(),
transition: $this.jqmData( "transition" ),
reverse: $this.jqmData( "direction" ) === "reverse",
reloadPage: true
}
};
}

return ret;
};

//bind to form submit events, handle with Ajax
Expand Down

0 comments on commit 283c567

Please sign in to comment.