how to use ajax request in jsFiddle

ptamzz picture ptamzz · Sep 10, 2011 · Viewed 18.7k times · Source

I'm trying to create my first fiddle. So here's what I want to do with jquery

$('.list').live('click', function(){
    var dataPass = 'uid='+ uid;
    $.ajax({
        type: "POST",
        url: "test.php",
        data: dataPass,
        cache: false,
        success: function(html){
            //Do something
        }
    });
});

So how/where do I write the codes for test.php file? It's going to return some html markup.

Answer

Joe picture Joe · Sep 10, 2011

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.