2011-05-05 2 views
0

jQuery Ajax를 사용하여 JSP에서 샘플 API를 호출하려고하는데 성공하지 못합니다. 나는 어디에서 잘못 되었는가 그러나 간단한 html 페이지조차 짐을 얻고 ​​있지 않다는 것을 모른다.jquery를 사용하여 Ajax 호출을 수행 할 수 없습니다.

여기 내 코드입니다.

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" 
    pageEncoding="ISO-8859-1"%> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
    "http://www.w3.org/TR/html4/loose.dtd"> 

<html> 
<head> 
<script src="http://code.jquery.com/jquery-latest.min.js"></script> 
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> 
<title>Insert title here</title> 
</head> 
<body> 
Hello 
<div id="temp"> 

<a href="#" onclick="callGetApplicationDetails();" >Click Here</a> 

</div> 
<script type="text/javascript"> 
function callGetApplicationDetails() 
{ 
    $.ajax({ 
     url:"serverFile.jsp", 
     type: "GET", 
     dataType:'html', 
     async: true, 
     data:data, 
     success: function(responseData) { 
      if (responseData != null && callback != null) { 

      alert('success'); 

      $('#temp').html(responseData); 


      } 
     }, 
     error: function(){ 

      alert('error'); 

      if (errorCallback !=null) errorCallback(); 
     } 
    });  
    } 

</script> 

</body> 
</html> 

심지어 경고는 성공과 실패가 나타나지 않습니다. enter image description here

Pls help.

감사 Hemish는

+1

어디에서'callback' (null과 비교할 것인가)을 선언합니까? – Gabriel

+0

JS 오류를 보여주는 개발 도구를 사용하여 Firefox의 Firebug, Chrome 개발자 도구 등을 확인합니다. –

+0

고마워요. 가브리엘. 나는이 단순한 일을보기에 망쳐 놓고 귀여웠다. – Gendaful

답변

1

난 당신이 불을 지르고를 사용하는 것이 좋습니다, 그리고 요청이 서버로 제작되어 있는지 확인합니다.

관련 문제