Reputation: 1432
I'm new to ASP and JQuery. I need to pass my datepicker value to Controller action. So I'v created datepicker using JQuery UI:
<input class="date-picker" />
And script for it:
<script type="text/javascript">
$(function () {
$('.date-picker').datepicker();
})
</script>
Also I have a controller method:
public ActionResult LoadData(string dateFrom)
{
// Here I'm loading data and return partialView
}
So this is how I'm trying to pass value:
<script type="text/javascript">
var url = '@Url.Action("LoadData", "Home")';
$('#Load').click(function() {
var from = $('#date-picker').val();
$('#result').load(url, { from: from });
})
</script>
So if I pass I simple string thats works, but if I'm try to pass dateOicker value I'v got null in LoadData method.
What's wrong?
Upvotes: 0
Views: 827