Skip to content

Commit 0eab82b

Browse files
Fix #177 (Null values aren't serialized correctly)
Fix by serializing null and undefined values to blank strings. This is what jQuery also does.
1 parent 064bcc2 commit 0eab82b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ajax.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ $._formData = function (o) {
7676
var kvps = [], regEx = /%20/g, val;
7777
for (var k in o) {
7878
val = o[k];
79-
val = typeof val === "undefined" || val === null ? "" : val;
79+
val = (val == null) ? "" : val;
8080
kvps.push(encodeURIComponent(k).replace(regEx, "+") + "=" + encodeURIComponent(val.toString()).replace(regEx, "+"));
8181
}
8282
return kvps.join('&');

0 commit comments

Comments
 (0)