0
我使用了與其他網站的數據不同的相同代碼,它在本地和在線工作但該新網站不接受表單給我一個錯誤,任何人都可以幫忙?我在嘗試在我的網站上放置一個html php表單時出現此錯誤jQuery
HTML的腳本 :
<script src="http://code.jquery.com/jquery-1.8.3.min.js" type="text/javascript"></script>
<meta charset="utf-8">
<title>Untitled Document</title>
<script>
$(function() {
$("#Message").validate({
rules: {
Name: {
required: true,
minlength: 2,
maxlength: 15
},
Email: {
required: true,
email: true
},
Message: {
required: true,
minlength: 10
}
}});
});
</script>
形式:
<p><form id="Message" method="POST" action="message.php">
<p>Enter Name: <input id="Name" type="text" name="Name" size="20"></p>
<p>Enter Email: <input id="Email" type="text" name="Email" size="20"></p>
<p>Message: <input id="Message" type="text" name="Message" size"20"></p>
<p><input type="submit" value="Submit" name="Submit"></p>
PHP Message.php:
<?php
## CONFIG ##
# LIST EMAIL ADDRESS
$recipient = "MYEMAIL";
# SUBJECT (Subscribe/Remove)
$subject = "WebMsg";
# RESULT PAGE
$location = "received.html";
## FORM VALUES ##
$sender = $recipient;
# MAIL BODY
$body .= "Name: ".$_REQUEST['Name']." \n";
$body .= "Email: ".$_REQUEST['Email']." \n";
$body .= "Message: ".$REQUEST['Message']." \n";
# add more fields here if required
## SEND MESSGAE ##
mail($recipient, $subject, $body, "From: $sender") or header("Location: $location");
## SHOW RESULT PAGE ##
header("Location: $location");
?>
最後控制檯錯誤:
Uncaught TypeError: $(...).validate is not a function(anonymous function) @ index.html:15v.Callbacks.l @ jquery-1.8.3.min.js:2v.Callbacks.c.fireWith @ jquery-1.8.3.min.js:2v.extend.ready @ jquery-1.8.3.min.js:2A @ jquery-1.8.3.min.js:2
我會非常感激,如果有人可以回答,幫我這是煩人我現在
難道你忘了,包括在'
的'jquery.validate.min.js'腳本'? – uri2x