I have a very basic problem related to ajax jquery , need some guidance
$.ajax({
type:"get",
url:"www.google.com",
success: function(html) {
alert("success");
},
error : function(request,status,error) {
alert(status);} //edited
});
I am getting status as "error" , error variable as "". I am not sure whats the problem . Check even with Verb "POST".
Edit : There was a typo in typing here. The syntax seems to be correct , even then the same error.
Here is the jsfiddle: https://jsfiddle.net/1988/z7nnf0fh/
Your url is the problem for the error
$.ajax({
type:"get",
url:"https://httpbin.org/", //Remove the url here..
success: function(html) {
alert("success");
},
error : function(request,status,error) {
alert(status);} //edited
});
After removing this URL, got success
in alert. See on fiddle https://jsfiddle.net/smit_patel/0gety9oj/