JSFiddle - React, Tailwind, and code Playground

by SASSACB

HTML

<script data-cfasync="false" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<button onclick="callGoogleScript()">Click me</button>

<p id="result">

</p>
<script>

  
  // Make an AJAX call to Google Script
  function callGoogleScript() {
    
    var url = "https://script.google.com/macros/s/AKfycbxNwTRHb--lubpUxsoa2qe6dcZ3wx6FFxRzjAmIWIbiSqYCUCE/exec?callback=ctrlq&name=";
    var name = "Amit Agarwal"

    var request = jQuery.ajax({
      crossDomain: true,
      url: url + encodeURIComponent(name),
      method: "GET",
      dataType: "jsonp"
    });

  }

  // print the returned data
  function ctrlq(e) {
  document.getElementById("result").innerHTML = e["result"] + "sending..."
    alert(e.result)
    var obj = e["result"];
document.getElementById("result").innerHTML = obj
  }

</script>

JavaScript

// Make an AJAX call to Google Script
  function callGoogleScript() {
    
    var url = "https://script.google.com/macros/s/AKfycbxNwTRHb--lubpUxsoa2qe6dcZ3wx6FFxRzjAmIWIbiSqYCUCE/exec?callback=ctrlq&name=";
    var name = "Amit Agarwal"

    var request = jQuery.ajax({
      crossDomain: true,
      url: url + encodeURIComponent(name),
      method: "GET",
      dataType: "jsonp"
    });

  }

  // print the returned data
  function ctrlq(e) {
    alert(e.result)
  }