Bug Tracker

Modify

Ticket #10090 (closed bug: invalid)

Opened 22 months ago

Last modified 22 months ago

ajax is sending null on Date type data

Reported by: martin.borthiry@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.6.2
Keywords: Cc:
Blocking: Blocked by:

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()});

Change History

comment:1 Changed 22 months ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid

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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.