Guest User

Untitled

a guest
Jan 18th, 2018
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. <form action="" id='cbhandler' method='POST' class="callback-popup-form">
  2. <input type="text" name='phone' class="main-input callback-input" placeholder="Телефон" id="phone">
  3. <button class="callback-submit login-popup-submit">Перезвонить</button>
  4. </form>
  5.  
  6. $('#cbhandler').submit(function(e){
  7. event.preventDefault();
  8. var $form = $(this);
  9. var serializedData = $form.serialize();
  10.  
  11. $.ajax({
  12. url: '/cbhandler.php',
  13. method: 'POST',
  14. data: serializedData,
  15. success: function(txt){
  16.  
  17. return false;
  18. },
  19. error: function(txt){
  20. return false;
  21.  
  22.  
  23. }
  24. });
  25.  
  26. if(isset($_POST)){ $tel = isset($_POST['phone']) ? $_POST['phone'] : 'ewqqw';
  27. if(preg_match("/+380([0-9]{2}) [0-9]{3}-[0-9]{2}-[0-9]{2}/", $tel)){
  28. mail('email@gmail.com', 'MirBeer: Заказ обратного звонка', 'Клиент: '.$tel.'');
  29. }}
  30.  
  31. $('#cbhandler').submit(function(e){
  32. event.preventDefault();
  33.  
  34. $('#cbhandler').submit(function() {
  35. $.preventDefault(); //
  36. ...
  37.  
  38. $('ID_батона_в_формы').click(function() {
  39. ...
Add Comment
Please, Sign In to add comment