echo json and HTML for jsFiddle

this gives a simple example to use the jsFiddle echo services in HTML and JSON.

by DarMontou

HTML

<div id="ajax-json"></div>
<div id="ajax-html"></div>

JavaScript

$(function() {
    $.ajax({
        cache:false,
        type: 'POST',
        url: '/echo/json/',
        data: {
            json:'{"n":"1","txt":"No apostrophe"}',
            delay: 2
        },
        success: function(data) {
            $('#ajax-json').html(data.n);
        },
        error:function(error){
            alert('there was an error');  
        },
        dataType: 'json'
    });
    
    $.ajax({
        cache:false,
         type: 'POST',
         url: '/echo/html/',
         data: {
             html:'<b>HTML</b>'
         },
         success: function(data) {
             $('#ajax-html').html(data);
         },
         error:function(error){
             alert('there was an error');  
         },
         dataType: 'html'
     });
    
});