By arunraj
Use the following code to validate urls in jquery.
function validateUrl(e){
var urlPattern = new RegExp(/(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/);
var spaceCharPattern = new RegExp(/[\s]/);
if (!urlPattern.test($(e.target).val()) || spaceCharPattern.test($(e.target).val())) {
alert("invalid url");
}
}