Hi! I have a form with 2 fields datepicker. How do I check both boxes have a date before I send ajax data? Here is my code. It examines only one data field... (document).ready(function(){ $('#datepicker, #datepicker2').change(function () { var datepicker = $('#datepicker').attr('value'); var datepicker2 = $('#datepicker2').attr('value'); $.ajax({ type: "POST", url: "test/ajax", data: "datepicker="+ datepicker +"& datepicker2="+ datepicker2, success: function(){} }); }); PHP: form with two input tags <form id='submit' action="/frontend_dev.php/availability" method="POST"> <input class="text" id="datepicker" type="text" name="CheckIn" /> <input class="text" id="datepicker2" type="text" name="CheckOut" /> </form> PHP: The code only checks one of the two fields and sends the data. Pfu.
just use a simple if statement to check the values of the two datepicker variables before firing off the ajax request