I am kind of new to JQuery. My requirement is to validate a link from another domain. If success, then redirect (Open the page a new window) to that link, otherwise show alert.
What I tried in Jsfiddle are given below:
$.ajax({
url: "/user/login",
method: 'head',
error: function(){
alert('Failure');
},
success: function(){
alert("Success");
}
})
The above one succesfully validated the URL. But once I changed the url to http://www.google.com, it is not working. Code snippet is given below:
$.ajax({
url: "http://google.com",
method: 'head',
error: function(){
alert('Failure');
},
success: function(){
alert("Success");
}
})
Any idea why this is not working and is there any way to solve that? I just found out that cross domain validation is not supported in JQuery. Is it true?