I'm new to asp.net MVC5, please be patient.
I have a controller which returns ActionResult with a model,I can use this model through Razor but I'd like to use it in JavaScript.
I searched for examples and tried then reached to this result
$('document').ready(function () {
$("#Arrival").datepicker({
minDate: 0,
maxDate:userObj , ////here i want to pass model value
dateFormat: 'dd/mm/yy',
showOn: "button",
buttonImage: "img/ui_cal_icon.gif",
buttonImageOnly: true,
buttonText: "Select date",
});
});
this is the script from the view i want to pass this values i got it to maxDate in datepicker
<script type="text/javascript">
var userObj = @Html.Raw(Json.Encode(Model.MaximumDaysAheadBookable)); //For javascript object
</script>
Thanks for help .