Click here to Skip to main content
15,892,697 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hey guys, I want this code to be called when a date is selected in a SPA with ember, what's happenning is that this will only be called if I refresh the page, how can I call it without refreshing page?

C#
$(document).ready(function () {
    var event = new Date();
    var arrival = new Date();
    var departure = new Date();
    var departureFlight = new Date();
    var returnFlight = new Date();

    event = $('#inputEventStart').data('date');
    arrival = $('#inputArrival').data('date');
    departure = $('#inputDeparture').data('date');
    departureFlight = $('#inputFlDeparture').data('date');
    returnFlight = $('#inputFlReturn').data('date');

    if (arrival < event) {
        alert("Arrival date must be after the event!");
        sender._textbox.set_Value('');
    }
    if (departure > event) {
        alert("Departure date must be before the event!");
        sender._textbox.set_Value('');
    }
    if (returnFlight < departureFlight) {
        alert("Return flight must be after flight departure");
        sender._textbox.set_Value('')
    }
});
Posted
Comments
ZurdoDev 12-Feb-15 22:20pm    
That code is in document.ready which only runs when the page loads. Just move it to a function and call as needed.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900