I am using [MultiDatesPicker](
http://multidatespickr.sourceforge.net/ ) plugin in my Rails project. My goal is to do an Ajax call and then get the dates which needs to be disabled. After that, once I will click any enabled date it should select a range of date as per the Ajax response `interval`. Here is my code :
$(function() {
$(document).on('change', '#booking_package_type', function() {
var bol = $.inArray( $(this).val(), [ "weekend", "full_week", "midweek", "" ] );
var pkg_type = $(this).val();
//....
$.get( "/admin/bookings/fetch_dates", { package_type: pkg_type } )
.done(function( data ) {
console.log( data.interval );
$('#booking_start_date').multiDatesPicker('resetDates', 'disabled');
$('#booking_start_date').multiDatesPicker({
dateFormat: "yy-mm-dd",
mode: 'daysRange',
autoselectRange: [0, data.interval],
addDisabledDates: data.dates
});
});
});
});
But once I am clicking on any enable date, I am getting the error as :
Uncaught Unexpected literal at position 2
Any idea why am I getting the error ?