JSFiddle - React, Tailwind, and code Playground

by Tariqul Islam

HTML

<a href="#" onclick="return runAjax();"> Deny Order 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: "https://tiffintom.com/api/private/request/data",
          type: "POST",
          dataType: "json",
          data: {
                "RESTAURANT":{"APIKEY":"jurd3WvjnweVASwx6oU5kwuA1mBAo9vwtMAnyUvL"},
                "REQUESTPARAM":[
                    {
                        "MODULE":"putitem",
                        "METHOD":"denyOrder",
                        "PARAMS":{
                            "ORDERID": 170,
                            "CUSTOMER_EMAIL": "[email protected]",
                            "ORDER_TYPE": "Collection",
                            "ORDER_STATUS": "Web Order Unpaid",
                            "IS_COMING_FROM_WEB": 1,
                            "ORDER_DATE": "2017-05-23 15:41:18",
                            "LAST_UPDATE": "2017-05-23 15:41:18",
                            "IS_NEW": 1,
                            "DELIVERY_CHARGE": 0
                        }
                    },
                ],
            },
            success:function(data) {
                console.log(data);
                $("#responseData").html(JSON.stringify(data));
            },
            error: function () {
                $('#responseData').html('There was an error!');
            }
    });
    
    return false;
}