Advertisement
ElGecko

Untitled

Feb 9th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(function () {
  2.             let registerForm = "{{ path('site_devenir_vip_ajax_payment_form') }}";
  3.  
  4.             $("#spinner")
  5.                 .hide();
  6.  
  7.             $("#userPaymentForm")
  8.                 .submit(function (e) {
  9.                     e.preventDefault();
  10.  
  11.                     $.ajax({
  12.                         url: registerForm,
  13.                         type: "POST",
  14.                         dataType: "json",
  15.                         data: $(this)
  16.                             .serialize(),
  17.                         beforeSend: function () {
  18.                             $("#spinner")
  19.                                 .show();
  20.                         },
  21.                         success: function (data, textStatus, xhr) {
  22.                             if (xhr.status === 200 && textStatus === "success") {
  23.                                 console.log(data.template);
  24.                                 $("#userForm")
  25.                                     .html(data.template);
  26.                                 console.log("here 1");
  27.                                 $("#paymentForm")
  28.                                     .submit();
  29.                                 console.log("here 2");
  30.                             } else {
  31.                                 console.log(data);
  32.                             }
  33.                         },
  34.                         complete: function () {
  35.                             $("#spinner")
  36.                                 .hide();
  37.                         },
  38.                         error: function (jqXHR, status, error) {
  39.  
  40.                         },
  41.                     });
  42.                 });
  43.  
  44.             $("#paymentForm")
  45.                 .submit(function (e) {
  46.                     e.preventDefault();
  47.                     console.log('iciiii')
  48.                 });
  49.         });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement