Skip to content
Permalink
Browse files

jquery ajax: support for dynamic data arguments, see #2806; added tes…

…t/data/echoQuery.php for easier testing of sent query strings
  • Loading branch information
jzaefferer committed May 6, 2008
1 parent 1753ab3 commit 46931d3146b454298231fc80a6c2d3894b125fde
Showing with 18 additions and 1 deletion.
  1. +1 −1 src/ajax.js
  2. +1 −0 test/data/echoQuery.php
  3. +16 −0 test/unit/ajax.js
@@ -489,7 +489,7 @@ jQuery.extend({
s.push( encodeURIComponent(j) + "=" + encodeURIComponent( this ) );
});
else
s.push( encodeURIComponent(j) + "=" + encodeURIComponent( a[j] ) );
s.push( encodeURIComponent(j) + "=" + encodeURIComponent( jQuery.isFunction(a[j]) ? a[j]() : a[j] ) );

// Return the resulting serialization
return s.join("&").replace(/%20/g, "+");
@@ -0,0 +1 @@
<?php echo $_SERVER['QUERY_STRING']; ?>
@@ -811,6 +811,22 @@ test("custom timeout does not set error message when timeout occurs, see #970",
});
});

test("data option: evaluate function values (#2806)", function() {
stop();
$.ajax({
url: "data/echoQuery.php",
data: {
key: function() {
return "value";
}
},
success: function(result) {
equals( result, "key=value" );
start();
}
})
});

}

//}

0 comments on commit 46931d3

Please sign in to comment.
You can’t perform that action at this time.