Toolkit:json:xsite

From Surebert wiki

Overview

Available since tags 4.82.

You can use sb.json.xsite in order to dynamically load json data into a callback function. While you can easily use sb.ajax for loading json data on the same doamin, sb.ajax does not allow you to load json data from another domain. To get around this you can use sb.json.xsite, however, you should be aware that this could be dangerous if you do not trust the 3rd party you are loading the javascript from.

Example

javascript code

var xsite = new sb.json.xsite({
    url : 'http://somesite.com/get_user/78',
    data : {
        'dog' : 'big'
    },
    callback : function(json){
       alert(json.uname);
    }
});
 
xsite.fetch();

Testing

to test with test json string

javascript code

xsite.fetch({uname: 'paul'});