JSFiddle - React, Tailwind, and code Playground
by Tariqul Islam
HTML
<a href="#" onclick="return runAjax();"> Check </a>
<div id="responseData">
Waiting for Action...
</div>
CSS
#responseData {
margin-top: 15px;
font-family: "Arial"
}
JavaScript
// handles the click event, sends the query
function runAjax() {
$("#responseData").html("Collecting your Data...");
$.ajax({
url: "http://vtechs.website/afrdi/api/public/request/data",
type: "POST",
dataType: "json",
data: {
"USER":{"APIKEY":"m8198kN5QcQwg6fTPx7kLEFfM4SJApcWwD88mLVe"},
"REQUESTPARAM":[
{
"MODULE":"getitem",
"METHOD":"checkUser",
"PARAMS":{
"EMAIL": "[email protected]",
"PWD" : "123456",
"REGID" : "fHYqzaAj9F8:APA91bHM3VGbey3uxe09Pi641ilv0vB1Pp9efzqwJ_36-1Gf_3yfxl7vi1dg-wq1HuY42IlQVYUYtQGpHtcBGaz-oaBL9C_Ykl09wNKNZAcsjli-50tmIfxPxC41cRggyhtJ3mSRlBxm"
}
}
]
},
success:function(data) {
console.log(data);
$("#responseData").html(JSON.stringify(data));
},
error: function () {
$('#responseData').html('There was an error!');
}
});
return false;
}