Skip to content

Instantly share code, notes, and snippets.

@jordanilchev
Last active August 29, 2015 13:59
Show Gist options
  • Select an option

  • Save jordanilchev/10739754 to your computer and use it in GitHub Desktop.

Select an option

Save jordanilchev/10739754 to your computer and use it in GitHub Desktop.
A Pen by Jordan Ilchev.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<title>Hello World!</title>
</head>
<body>
<button id=test onclick="testCors();" >Test Cors</button>
<div id="result"></div>
<script type="text/javascript" src="cordova.js"></script>
<script src="jquery-mobile/js/jquery-1.9.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
function testCors() {
var url = "https://weather.yahooapis.com/forecastrss?w=2502265&u=c",
resultDiv = document.getElementById("result");
resultDiv.innerText = "";
$.ajax(url)
.then( function(data) {
console.log( data );
resultDiv.innerText = "just works :)";
},
function(e) {
resultDiv.innerText = "Error " + e.message;
});
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment