Sam Hobbs

Sam Hobbs

  • 51
  • 29k
  • 2m

getJSON does not execute

Mar 18 2014 11:45 PM
I cannot get "getJSON" to work. It is not executing. If I put the URL into a browser it downloads the data, so I know the URL is correct. I have included some HTML here that is nearly the entire HTML file that I am using. I have omitted the URL since it requires a login to work.
Could the login be a problem? As I said, the URL works if I use it in a browser; I am logged into the web site and obviously that is being used when I put the URL directly into a browser.


<!DOCTYPE html>

<html>

 <head>
<meta content="en-us" http-equiv="Content-Language" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<script type="text/javascript"
src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script type="text/javascript">
function GetMembers() {
var url="myurl";
var message = "start | ";
$.getJSON(url, function(result,status,xhr) {
message += "status =" + status;
});
message += " | end";
json.innerText = message;
}
</script>
</head>

 <body>
<p><input type="button" onclick="GetMembers()" value="Go"/></p>
<p><textarea id="json" cols="80" rows="60" ></textarea></p>
</body>

 </html>

When I press "Go" I get "start | | end" which indicates that getJSON is not executing or at least not working.




Answers (2)