JQuery Json Access of a Sharepoint List via Rest

Viewed 12114

I try to access a sharepoint list via Jquery and REST Interface. The Site with the code below is running localhost.

This code doesn't work:

$(document).ready(function() { getdata(); });

function getdata() {

    alert("start");

    $.ajax({
        url: "http://spkerberostest.vz.ch/_vti_bin/ListData.svc/Tasks",
        dataType: 'JSON',
        success:function(json) { alert ("Success");
        },
        error:function(){
            alert("Error");
        }
    });        
};

I get the Error Message "Origin http://localhost:59936 is not allowed by Acess-Control-Allow-Origin."

I'm not sure what the reason is. Is it the fact that Sharepoint needs Authentication (anonymous is blocked) or is it the cross-domain call? Or even both?

What can I do? I read somewhere about JSONP as Data Type. But this didn't work. Thanks.

4 Answers
Related