Advertisement
Guest User

rq

a guest
Sep 19th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. function req() {
  2. var year = document.getElementById('year').value;
  3. var month = document.getElementById('month').value;
  4. var day = document.getElementById('day').value;
  5.  
  6. function leapYear(year){
  7. return year % 4 == 0 && (year % 100 == 0 || year % 400 == 0);
  8. }
  9.  
  10. if (month == 2 && day > 28 && !leapYear(year)){
  11. alert("Wrong Date!");
  12. }
  13. else if ((month == 4 || month == 6 || month == 9 || month == 11) && day > 30){
  14. alert("Wrong Date!");
  15. }
  16. else {
  17.  
  18. var request = $.ajax({
  19. url: "main.php",
  20. method: "POST",
  21. data: {year: year, month: month, day: day},
  22. success: function (res) {
  23. //document.documentElement.innerHTML = res;
  24. alert(year + " " + month + " " + day);
  25. }
  26. })
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement