jquery datepicker sending date not as a string using .serialize()
When I am sending my date using .serialize() it is sending as an string not exact date format ..开发者_如何学C.is there a way I can send it as 09/01/2010... not as a string
Everything is posted to the server as a string...this is just how HTTP POST works. You can change the format, but it'll be a string no matter what date format you use.
If you're using the jQuery UI Datepicker you can populate another field used for posting use the altField
and altFormat
options, for example:
$("#datepicker").datepicker({
altField: '#FieldToPost',
altFormat: 'yyyy-mm-dd' //whatever format here
});
For format information, check our your options here.
Datepicker just writes values to a input box, which is a string. In the page this form is being posted to, you can convert the string to a date.
精彩评论