После отправки формы оформления заказа на woocommerce я хотел бы запустить этот скрипт ниже - PullRequest
0 голосов
/ 25 сентября 2019

Куда я положил этот скрипт?Как запустить его после отправки формы оформления заказа?

<script type="text/javascript">
  var cbIntegrationId = "xxxxx"; //I have it
  var clientId = "50a83f7c22754af503b656a7c82c7b734ab9e433fbb0eebf2f"; //Required
  var clientSecret = "88227846304745959a0cdd55ecc0d30b9869d40e4be0000f85"; //Required
  var tableName = "Test_Database"; //Required
  var name = "My_Name"; // How I get This value after submit the checkout form)??

    //Get access token
    $.post(
      "https://" + cbIntegrationId + ".caspio.com/oauth/token",
      {
        grant_type: "client_credentials",
        client_id: clientId,
        client_secret: clientSecret
      },
      function(cbAuth){
        //Run POST call
        $.ajax({
          url: "https://" + cbIntegrationId + ".caspio.com/rest/v2/tables/" + tableName + "/records?response=rows",
          type: 'POST',
          'data': JSON.stringify({"Drivers_Full_Name":name}), //Define record values
          headers: {
            "Authorization": "Bearer " + cbAuth.access_token, //Extracts the access token from the initial authorization call
            "Content-Type": "application/json", //Required, otherwise 415 error is returned
            "Accept": "application/json"
          },
          dataType: 'json',
          success: function (data) {
            console.log(data.Result); //Check the console to view the new added row
          },
          error: function(data) {
            console.log(data.responseJSON); //Check the console to view error message if any
          }
        });
      }
    );

</script>

Хотелось бы узнать: 1. Получить значения настраиваемых полей 2. Отправить значения в скрипт 3. Запустить скрипт после нажатия на оформление заказа

Мне нужна помощь ....................................

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...