JSFiddle - React, Tailwind, and code Playground

by igalst

HTML

<script src="http://jquery-json.googlecode.com/files/jquery.json-2.2.min.js"></script>
<button type="button">click me</button>

JavaScript

var postData = {
    json: '{ "text": "some text","array": [1, 2, "three"], "object": {"par1": "another text", "par2": [3, 2, "one"], "par3": {}, "par4": false}}'
};
console.log("postData =", postData);
    
$("button").on("click", function(){

    $.ajax({
        url: "/echo/json/",
        data: postData,
        type: "POST"
    }).done(function(response) {
       console.log(response);
       console.log(response.text.indexOf("some") >= 0);
        
        for (var i = 0; i < response.object.par2.length; i++) {
            $("body").append("<div>" + response.object.par2[i] + "</div>");
        }
    });

});