Hi,
Base on my previous test, I add one simple ajax function.
Now, the submit function does not work correctly under Safari and Opera, but
still works fine under IE/FF.
I will try write AJAX call in javascript(without jquery), because I am not
sure it's compatibility problem of Jquery or javascript.
Thanks.
Arden
============AJAX====================================
<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Insert title here</title>
<script type="text/javascript" src="<c:url
value='/javascripts/jquery/jquery-1.2.6.js'/>"></script>
 <script type="text/javascript">
  var ipVal=0;
  function refreshProgress(){
    ipVal = ipVal + 1;
    $.getJSON(
       "<c:url value='/json.jsp'/>",
       {ip:ipVal},
       function(data){
        $("#test1").val(data.uploadProgress.percent);
    });
    setTimeout(refreshProgress, 1500);
  }
   $(function(){
    $("#buttonTest").click(function(){
     setTimeout(refreshProgress, 1500);
    });
    $("#formtest").submit(function(){
     setTimeout(refreshProgress, 1500);
    });
   });
 </script>
</head>
<body>
 <button id="buttonTest">Click Me!</button>
 <form id="formtest" action="s.jsp" >
  <input id="test1" type="text" name="fname" value="Default" />
  <input type="submit" id="submitButton" value="submit"/>
 </form>
</body>
</html>
============json.jsp====================================
{"uploadProgress":{"bytesRead":58722,"percent":37}}

Reply via email to