Created
March 29, 2012 07:28
-
-
Save sebm/2234535 to your computer and use it in GitHub Desktop.
How to get JSONP working cross domain
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>JSONP test</title> | |
<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'></script> | |
</head> | |
<body> | |
<script> | |
var named_callback = function() { | |
console.log('whoo it worked') | |
console.log(arguments) | |
}; | |
$(function() { | |
$.ajax({ | |
url: 'http://0.0.0.0:8000/jsonp.js', | |
dataType: 'jsonp' | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
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
named_callback({ foo: 'bar' }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment