Last active
December 11, 2015 17:48
-
-
Save nathanathan/4636888 to your computer and use it in GitHub Desktop.
Ajax request example
This file contains 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> | |
<meta charset="utf-8"> | |
<style> | |
body { | |
font: 10px sans-serif; | |
} | |
</style> | |
<body> | |
<pre id="result"></pre> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js" type="text/javascript"></script> | |
<script> | |
$(function(){ | |
$.ajax({ | |
url: "http://query.yahooapis.com/v1/public/yql/", | |
dataType: "json", | |
data: { | |
"env":"http://github.com/spier/yql_worldbank/raw/master/alltables.env", | |
"q":'select * from weather.forecast where woeid=2502265', | |
"format": "json", | |
"jsonp" : "?" | |
}, | |
success: function(res) { | |
$("#result").text(JSON.stringify(res,2,2)); | |
} | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment