JSFiddle - React, Tailwind, and code Playground
by danny8376
HTML
<input type="button" value="Do AJAX" id="ajax1">
<input type="button" value="Alert Value" id="test">
JavaScript
var persistent_data;
$(document).ready(function() {
$("#ajax1").click(function() {
$.get("show", function(cont) {
// got data1
persistent_data = cont;
// then try to get data2
$.get("../../4/show", function(cont) {
alert(cont == persistent_data);
})
})
})
$("#test").click(function() {
alert(persistent_data);
})
})