I have created a small form which have one field for input the url and the other one is submit button and i want to validate the input url through the javascript so that in case of correct url it will show an alert box.Is it possible with javascript? If yes , please help me to getting this through the below code.
<form name="lln-form" class="llnfrm" id="lln-form" id="bulk-form" action="" method="post" onsubmit="javascript:event.preventDefault();return submit_ajax();">
<fieldset style="">
<label>Enter URL:</label>
<input type="text" name="url" placeholder = "enter your url">
</fieldset>
<input class="lln-button button button-primary" type="submit" name="lln-submit" id="llnbuton" value="Save" onsubmit = "saveURL()"; />
</form>
<script type="text/javascript">
function saveURL()
{
<?php
if(isset($POST['url'])==true&&empty($POST['url'])==false){
$url=$POST['url'];
if(filter_var('$url',FILTER_VALIDATE_URL)==true)
echo "VAlid URL";
}
?>
}