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, "+");
--- /dev/null
+<?php echo $_SERVER['QUERY_STRING']; ?>
\ No newline at end of file
});
});
+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();
+ }
+ })
+});
+
}
//}