Skip to content

Instantly share code, notes, and snippets.

@nathanathan
Last active December 11, 2015 17:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathanathan/4636888 to your computer and use it in GitHub Desktop.
Save nathanathan/4636888 to your computer and use it in GitHub Desktop.
Ajax request example
<!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