samedi 19 avril 2014

Get datepicker and pass to url


Vote count:

0




It is a datepicker. I need to pass selected date as parameters in php form url. The datepicker value is in jQuery. I got the selected date value through ajax and i posted as $_POST['from'] and $_POST['to'].



<script type="text/javascript">
$(document).ready(function(){
var frm = $('#easy_widget_form');
var first, second;
first = $(".hasDatepicker[name=from]").val();
second = $(".hasDatepicker[name=to]").val();
//alert(first + " , " + second);

first = $(".hasDatepicker[name=from]").datepicker('getDate');
second = $(".hasDatepicker[name=to]").datepicker('getDate');
//alert(first + " , " + second);

jQuery.ajax({
type: "POST",
url: "form_widget.php",
data: "first=" +first+"&second="+second,
dataType: "text",
success: function(){
alert("Done");
}
});
}};
</script>


When i pass the date in url http://ift.tt/1jlcqZP".$_POST['from']."&to".$_POST['to']; it doesn't work.


Error : String was not recognized as a valid DateTime.


can someone help?



asked 27 secs ago






Aucun commentaire:

Enregistrer un commentaire