Commit 46931d31 authored by Jörn Zaefferer's avatar Jörn Zaefferer

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

jquery ajax: support for dynamic data arguments, see #2806; added test/data/echoQuery.php for easier testing of sent query strings
parent 1753ab3d
...@@ -489,7 +489,7 @@ jQuery.extend({ ...@@ -489,7 +489,7 @@ jQuery.extend({
s.push( encodeURIComponent(j) + "=" + encodeURIComponent( this ) ); s.push( encodeURIComponent(j) + "=" + encodeURIComponent( this ) );
}); });
else 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 the resulting serialization
return s.join("&").replace(/%20/g, "+"); return s.join("&").replace(/%20/g, "+");
......
<?php echo $_SERVER['QUERY_STRING']; ?>
\ No newline at end of file
...@@ -811,6 +811,22 @@ test("custom timeout does not set error message when timeout occurs, see #970", ...@@ -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();
}
})
});
} }
//} //}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment