Hi, I have I’m doing an ajax call and the retured data is in a div container. The call is made when the user selects a date from the datepicker. When the data is returned it I have two datapacekers’s input box on the form. I only want one on the form. How do I prevent ajax call from puttinng two datapicker input boxes in the view?
Here’s the script which I’ve tried putting to the top and bottom of the form.
<script type="text/javascript">
$(document).ready(function () {
$("#datep").datepicker({ showOn: "both", buttonText: "Select Date", changeMonth: true, changeYear: true, yearRange: "-2:+2", showOtherMonths: true, onSelect: function (date, datepickder) {
var sltdDate = { selectedDate: date };
$.ajax({
type: "GET",
url: "/Schedule/GetSchedule",
data: sltdDate,
datatype: "html",
success: function (data) {
$("#returnedData").html(data);
}
});
}
});
});
</script>
<div id="returnedData">
@if (Model.Assignments != null)
{
//table header here
@foreach (var item in Model.Assignments.Select((x, i) => new { Data = x, Index = i }))
{
// @Html.DisplayFor(modelItem => item.Data)
//More item data here
}
</table>
}
</div>
<div class ="ui-widget" >
<label for ="datep">Date: </label><input id="datep" />
</div>