<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
$.ajax({
url: base_url + query,
type: 'GET',
success: function (parsedResponse, statusText, jqXhr) {
var responseText = jqXhr.responseText;
var ConditionMatched = parsedResponse.ConditionMatched;
var ConditionMatchedNum = parsedResponse.ConditionMatchedNum;
},
error: function (error) {
var status_code = error.status;
var status_text = error.statusText;
var data = jQuery.parseJSON(error.responseText);
var error_message = data.Message;
var error_description = data.Description;
var error_internal_code = data.InternalCode;
var error_url = data.HelpUrl;
}
});
</script>
Using YQL and JSONP
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script>
$.ajax({
url: "http://api.weatherunlocked.com/api/trigger/51.50,-0.12/current%20temperature%20gt%202?app_id={APP_ID}&app_key={APP_KEY}",
// the name of the callback parameter, as specified by the YQL service
jsonp: "callback",
// tell jQuery we're expecting JSONP
dataType: "jsonp",
// tell YQL what we want and that we want JSON
data: {
format: "json"
},
// work with the response
success: function( response ) {
// server response
console.log( response );
}
});
</script>