Request.JSON

sending a JSON request to the jsFiddle backend. Later on parse and display the data.

HTML

<div class='wrapper'>
    <p>JSON will be received in 3 seconds</p>
    <ul id='post'></ul>
</div>

CSS

body {
    font-family: Helvetica, Sans, Arial;
}
p, ul {
    padding: 10px;
}
ul {
    margin: 5px;
    border: 2px dashed #999;
}

JavaScript

var obj={text: 'some text',
            array: [1, 2, 'three'],
            object: {
                par1: 'another text',
                par2: [3, 2, 'one'],
                par3: {}
            },
         int:10
        };
$.ajax({
    url: 'http://fiddle.jshell.net/echo/json/',
    type:'post',
    processData :true,
    data: {
        json:$.toJSON(obj),
        delay:3
    },
   
    success: function(response) {
        
        show_response(response, $('#post'));
    }
});

show_response = function(obj, result) {
    $.each(obj,function(v, k) {
        if(typeof(k) == 'object'){
           var ul= $('<ul/>')
           show_response(k,ul);
            $('<li/>').append(v+" :{").append(ul).append("}").appendTo(result);
        }else{
            $('<li/>').append(v+" : "+k+",").appendTo(result);
        }
    });
   // result.highlight();
};