2016-07-08 5 views
-1

뷰 엔진으로 Thymeleaf를 사용하고 있습니다.Thymeleaf Jquery 구문 오류

Jquery 스크립트에서 구문 오류가 발생합니다.

매우 잘 작동하고 있으므로 컨트롤러를 게시하지 않았습니다.

여기

enter image description here

내가 여기에 잘못이 무엇인지 이해하지 못하는, 코드 여기

<!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> 

오류입니다. 당신의지도를 요구하십시오.

+0

이것은 매우 기본적인 구문 오류는 "이 '정답'이다", 당신은 자바 스크립트 디버깅에 몇 가지 기본적인 튜토리얼을 수행해야 할 수 있습니다. –

답변

1

견적 유형을 혼합해야합니다. 그것은 하나의 문자열

수 있도록 작은 따옴표와 내부 사람을 교체

+0

다음과 같이 작성됩니다. url : "" – Tareq