how to use ajax request in jsFiddle how to use ajax request in jsFiddle jquery jquery

how to use ajax request in jsFiddle


It's not possible to make an AJAX request to a domain other than the current one, as it's a pretty basic security risk.

jsFiddle have an API for testing AJAX requests which you should use instead.


Here's a working fiddle of what you are probably looking for.

I used http://echo.jsontest.com but you can substitute for your valid URL.

var echo = function(dataPass) {    $.ajax({        type: "POST",        url: "/echo/json/",        data: dataPass,        cache: false,        success: function(json){            alert("UID=" + json.uid + "\nName=" + json.value);        }    });};$('.list').live('click', function(){    $.get("http://echo.jsontest.com/uid/12345/value/nuno_bettencourt", function(data) {        var json = {            json: JSON.stringify(data),            delay: 1        };        echo(json);;    });​ });