Skip to main content

Bug Tracker

Side navigation

#10090 closed bug (invalid)

Opened August 18, 2011 03:33PM UTC

Closed August 18, 2011 04:23PM UTC

ajax is sending null on Date type data

Reported by: martin.borthiry@gmail.com 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.

http://jsfiddle.net/4zhKM/1/

Ej: $.post('send.php',{val:new Date()});

Attachments (0)
Change History (1)

Changed August 18, 2011 04:23PM UTC by dmethvin comment:1

resolution: → invalid
status: newclosed

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.