Javascript Thymeleaf Jquery语法错误
我使用Thymeleaf作为查看引擎 Jquery脚本抛出语法错误 请注意,我没有在这里发布控制器,因为它工作得很好 这是密码Javascript Thymeleaf Jquery语法错误,javascript,jquery,spring-boot,thymeleaf,Javascript,Jquery,Spring Boot,Thymeleaf,我使用Thymeleaf作为查看引擎 Jquery脚本抛出语法错误 请注意,我没有在这里发布控制器,因为它工作得很好 这是密码 <!DOCTYPE HTML> <html xmlns:th="http://www.thymeleaf.org"> <head> <title>Add Author</title> <meta http-equiv="Content-Type" content="text/html; charset=U
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>Add Author</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="../public/bootstrap-3.3.6-dist/css/bootstrap.css" th:href="@{/bootstrap-3.3.6-dist/css/bootstrap.css}"/>
<script src="../public/jquery/jquery-3.0.0.min.js" th:src="@{/jquery/jquery-3.0.0.min.js}"></script>
</head>
<body>
<h1>Add New Author</h1>
<div class="col-lg-3" >
<form class="addAuthorForm" role="form" action="#" th:action="@{/author/new-author}" th:object="${addNewAuthor}" method="post">
<div th:class="form-group" th:classappend="${#fields.hasErrors('phone')}? 'has-error'">
<label>Phone</label>
<input class="form-control" type="text" th:field="*{phone}" placeholder="Enter author's phone number"/>
<p th:if="${#fields.hasErrors('phone')}" class="label label-danger" th:errors="*{phone}">Phone Error</p>
</div>
<button type="submit" class="btn btn-default">Add</button>
<button type="reset" class="btn btn-default">Reset</button>
</form>
</div>
<script type="text/javascript">
$(document).ready(function() {
$(".addAuthorForm").validate(
{
rules: {
name: {
required : true,
remote : {
url: "<spring:url value='/author/isexist.html'/>",
type: "get",
data: {
phone: function() {
return $("#phone").val();
}
}
}
}
},
messages: {
name: {
remote: "Phone number already exists!"
}
}
}
);
});
</script>
</body>
</html>
添加作者
添加新作者
电话
电话错误
添加
重置
$(文档).ready(函数(){
$(“.addAuthorForm”).validate(
{
规则:{
姓名:{
要求:正确,
远程:{
url:“”,
键入:“获取”,
数据:{
电话:function(){
return$(“#phone”).val();
}
}
}
}
},
信息:{
姓名:{
远程:“电话号码已经存在!”
}
}
}
);
});
这里是错误
我不明白这里怎么了。寻求您的指导。您需要混合报价类型。用单引号替换内部字符串,使其成为单个字符串
“这是‘正确’的答案”这是一个非常基本的语法错误,您可能需要做一些关于javascript调试的基本教程。它写为,url:”