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

Commit 283c567

Browse files
author
Gabriel Schulhof
committed
Navigation: Add parameter calculateOnly to getAjaxFormData when the data itself is not important
1 parent e84cf61 commit 283c567

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

js/jquery.mobile.navigation.js

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,7 +1264,8 @@ define( [
12641264
//the following deferred is resolved in the init file
12651265
$.mobile.navreadyDeferred = $.Deferred();
12661266
$.mobile._registerInternalEvents = function() {
1267-
var getAjaxFormData = function( $this ) {
1267+
var getAjaxFormData = function( $this, calculateOnly ) {
1268+
var type, target, url, ret = true;
12681269
if ( !$.mobile.ajaxEnabled ||
12691270
// test that the form is, itself, ajax false
12701271
$this.is( ":jqmData(ajax='false')" ) ||
@@ -1274,9 +1275,8 @@ define( [
12741275
return false;
12751276
}
12761277

1277-
var type = $this.attr( "method" ),
1278-
target = $this.attr( "target" ),
1279-
url = $this.attr( "action" );
1278+
target = $this.attr( "target" );
1279+
url = $this.attr( "action" );
12801280

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

1304-
return {
1305-
url: url,
1306-
options: {
1307-
type: type && type.length && type.toLowerCase() || "get",
1308-
data: $this.serialize(),
1309-
transition: $this.jqmData( "transition" ),
1310-
reverse: $this.jqmData( "direction" ) === "reverse",
1311-
reloadPage: true
1312-
}
1313-
};
1304+
if ( !calculateOnly ) {
1305+
type = $this.attr( "method" );
1306+
ret = {
1307+
url: url,
1308+
options: {
1309+
type: type && type.length && type.toLowerCase() || "get",
1310+
data: $this.serialize(),
1311+
transition: $this.jqmData( "transition" ),
1312+
reverse: $this.jqmData( "direction" ) === "reverse",
1313+
reloadPage: true
1314+
}
1315+
};
1316+
}
1317+
1318+
return ret;
13141319
};
13151320

13161321
//bind to form submit events, handle with Ajax

0 commit comments

Comments
 (0)