Created
September 3, 2010 08:10
-
-
Save dynax60/563588 to your computer and use it in GitHub Desktop.
An example of JSONP usage (cross-domain) with JQuery.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="http://code.jquery.com/jquery-latest.min.js"></script> | |
</head> | |
<body> | |
<SCRIPT> | |
$(function() { | |
$('#clickme').click(function() { | |
$.getJSON('http://domain.tld/test/?foo=bar&callback=?', | |
function(jsonp) { | |
$('#jsonp-example').html(jsonp.result); | |
}); | |
}); | |
}); | |
</SCRIPT> | |
<div id="jsonp-example"><a id="clickme" href="javascript:void()">Click me</a></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment