No description, website, or topics provided.
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
lib
tests
.gitignore
LICENSE
Makefile
README.md

README.md

ScriptCaller v1.0.0

ScriptCaller is a library which allows for cross domain JSON-P requests in a cross-browser way. Most important feature is that it supports both onSuccess and onFailure callback on all browsers. It implements the following transports:

  • XMLHttpRequest with CORS support on modern browsers
  • XDomainRequest on IE8/9
  • script tag powered JSON-P on other browsers

Take a look at examples in examples/.

Usage

Attach a scriptcaller.min.js script to your page and do:

    var YQL = "http://query.yahooapis.com/v1/public/yql";
    var url = YQL+"?q=select%20item%20from%20weather.forecast%20where%20location%3D%2248907%22&format=json";
    OORTLE.ScriptCaller.call(url, function gotit(success, response, id) {
        if (success) {
            console.log('Request', id, 'succeeded:');
            console.log(response);
        } else {
            console.log('Request', id, 'failed');
        }
    });

Compatibility

  • Firefox 3-12
  • Chrome 16-19
  • IE 6-10
  • Safari 5
  • Opera 11.6
  • Nokia Web Browser S60/3.2 (e.g. Nokia E75)
  • Blackberry Hotspot browser 5.0.0 (e.g. Blackberry Storm 2)

People

  • Gleb Peregud - author
  • Anton Fedorov - contributor
  • Douglas Crockford - author of json2.js library which used in this project.
  • Steven Levithan - author of parseUri.js library used in this project.

Building

If files in lib/ has been changed juicer gem is required to rebuild minified and non-minified files.

To install juicer do:

sudo gem install juicer
sudo juicer install jslint
sudo juicer install yui_compressor

To rebuild scriptcaller.js and scriptcaller.min.js files:

make

License

Copyright (c) 2012 Livepress Inc.

This library is distributed under MIT license. See LICENSE file for details.