e.preventDefault(); // var jsonUrl = this.href + "&json=1"; $.ajax({ url: jsonUrl, type: "json", method: "get", success: function(data){ // do something with the data alert(data); } }); }); Another way you can get this error is if you add a script tag and have the src return HTML: If you don't think you are returning HTML, check if you are not getting a 404.