kinan
12/2/2013 - 5:33 PM

JSONP

JSONP

function GetVideos()
{
    var url = "<%= "#{@camera.auth_url(remote_ip)}/cgi-bin/sdcard.cgi?action=getSDstatusByJson" %>";
    $.ajax({
        type:'GET',
        url: 'http://ip.jsontest.com/',
        dataType: 'jsonp',
        contentType: "text/html",
        jsonpCallback: "ParseJson",

        success: function(data) {
                //data = JSON.parse(data):
                console.log(data);
        },
        error: function(xhrequest, ErrorText, thrownError) {
            console.log("PopulateDivisions2:  " + thrownError + " : " + ErrorText);
        }

    });

}

function ParseJson(){
  alert('ParseJson was called');
}