I am using JQuery Ajax function with php to check if email exists. This is working fine when using core-php. But when I am integrating the same in Joomla Page using Sourcer, I am getting the error in firebug console.
TypeError: $.ajax is not a function
The total code for JQuery and the form is like this:
<html>
<head>
<script src="form/js/jquery.js"></script>
<script type="text/javascript">
if (window.jQuery) {
alert("Jquery loaded!");
} else {
alert("Jquery not loaded!");
}
function checkemail()
{
var email=document.getElementById( "Email" ).value;
if(email)
{
$.ajax({
type: 'post',
url: 'form/checkdata.php',
data: {
user_email:email,
},
success: function (response) {
$( '#email_status' ).html(response);
if(response=="OK")
{
return true;
}
else
{
return false;
}
}
});
}
else
{
$( '#email_status' ).html("");
return false;
}
}
function checkall()
{
var emailhtml=document.getElementById("email_status").innerHTML;
if((emailhtml)=="OK")
{
return true;
}
else
{
return false;
}
}
</script>
</head>
<body>
<form method="POST" action="insertdata.php" onsubmit="return checkall();">
<input type="text" name="email" id="Email" onkeyup="checkemail();">
<span id="email_status"></span>
<br>
<input type="password" name="userpass" id="UserPassword">
<br>
<input type="submit" name="submit_form" value="Submit">
</form>
</body>
</html>