jquery getJSON returning a 404 Not Found

Rayham

New Member
I'm trying to run a simple jquery call to run some ajax and get some json. I keep getting a '404' error and can't figure out why despite looking at all the .getJSON returning a 404 error posts on SO. My code is pretty basic:\[code\] <html> <head> <script src="http://stackoverflow.com/questions/15753967/jqueryUrlHere"></script> <script> function runIt(){ //I know I should use a jquery function here $.ajax({url: 'http://mywebsite.com/js/example.json', dataType: 'json'}) .success(function(response){ document.getElementById('example').innerHTML = '<p>' + response.active + '</p>';}) .error(function() {alert("Error....you suck"); });} } </script> </head> <body> <a href="http://stackoverflow.com/questions/15753967/#" id="getdata-button" onclick="runIt()">Get Json Data</a> <div id='example'></div> </body> </html>\[/code\]Update[1]Looks like part of the problem is I had it on IIS...as soon as I threw it on Apache I got a correct response...but says undefined. My json file is simply: {"active":"yes"}
 
Back
Top