Advertisement
Guest User

Untitled

a guest
Aug 17th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. <form style="margin-top: 10px" id="formSend">
  2. <input type="text" class="name" name="name" placeholder="Jméno" id="na" required="">
  3. <input type="text" class="name" name="mail" placeholder="Email" id="em" required="">
  4.  
  5. <textarea placeholder="Vaše zpráva" id="ms" required=""></textarea>
  6. <input type="submit" id="btn1" style="float: right;" value="SEND MESSAGE">
  7. </form>
  8.  
  9.  
  10.  
  11. jQuery(document).ready(function ($) {
  12. $(".scroll").click(function (event) {
  13. event.preventDefault();
  14. $('html,body').animate({ scrollTop: $(this.hash).offset().top }, 1000);
  15. });
  16.  
  17. $("#reserve-button").click(function () {
  18. $("#sl").trigger("click");
  19. });
  20.  
  21. $("#more-button").click(function () {
  22. $("#more").toggle();
  23. if($.trim($("#more-button").text())=="Více")
  24. $("#more-button").text("Méně");
  25. else
  26. $("#more-button").text("Více");
  27. });
  28.  
  29. $('#formSend').submit(function (e) {
  30.  
  31. // Prevent form submission which refreshes page
  32. e.preventDefault();
  33. });
  34.  
  35. $('#btn1').click(function() {
  36. var val1 = $('#na').val();
  37. var val2 = $('#em').val();
  38. var val3 = $('#ms').val();
  39.  
  40. if(val1=="" || val2=="" || val3=="")
  41. {
  42. return;
  43. }
  44. $.ajax({
  45. type: 'POST',
  46. url: 'mail.php',
  47. data: { text1: val1, text2: val2, text3: val3 },
  48. success: function(response) {
  49. alert("Odesláno");
  50. }
  51. });
  52. });
  53.  
  54. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement