'jquery 간단한 ajax'에 해당되는 글 1건

  1. 2010.02.04 jquery 간단한 ajax
반응형

<%@ page language="java" contentType="text/html; charset=EUC-KR"
 pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
<script type="text/javascript" src="/js/jquery-1.4.min.js"></script>

<script type="text/javascript">
 $(document).ready(function() {
  $.ajax( {
   url : 'data.txt',
   type : 'GET',    
   dataType : 'txt', 
   timeout : 1000,
   error : function() {
    alert('Error loading XML document');
   },
   success : function(xml) {
    if(xml > 99){
     alert("99보다 크다 :"+xml);
    }else{
     alert("99보다 작다 :"+xml);
    }
  }
  });
 });
</script>

</head>
<body>
<div class="message">div</div>
</body>
</html>

Posted by 1010