Opened 11 years ago
Closed 11 years ago
#10090 closed bug (invalid)
ajax is sending null on Date type data
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.6.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Jquery.ajax is sending null/undefined when the data type is Date() .
Browser Chrome 10+/FFX 5, OS Win/Linux/Mac.
Ej: $.post('send.php',{val:new Date()});
Note: See
TracTickets for help on using
tickets.
jQuery
$.ajax
supports serializing plain Objects and primitive types to string. It doesn't know how to serialize a Date object to a string in a universal way. Did you want the.getTime()
value sent, or the ISO-8601 date format as a string (with or without the time)? By default, JavaScript usually converts a Date object to a *locale-defined* string, which is almost certainly NOT good.Convert the value to string representing the value you want to send before you give it to
$.ajax
.