ajax当中如何回传一个JSP?

4.PassBackJsp 



例 4.1

<%@ page contentType="text/html; charset=GBK"%>
<%@ page language="java"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<style type="text/css">
table.default {
    width:510px;
}
table.default td {
    border:1px solid black;
    height:23px;
}
table.default td.item {
    background:#006589;
    color:#fff;
    text-align:center;
}
</style>

<script type="text/javascript">
var xmlHttp;   
function createXmlHttp() {
    if (window.XMLHttpRequest) {
       xmlHttp = new XMLHttpRequest();                  //FireFox、Opera等浏览器支持的创建方式
    } else {
       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");//IE浏览器支持的创建方式
    }
}
function refreshCart() {
    createXmlHttp();                     
    xmlHttp.onreadystatechange = showCartIn;
    xmlHttp.open("GET", "cart.jsp" , true);
    xmlHttp.send(null);
}

更多参考原文地址:http://www.mark-to-win.com/index.html?content=Javascript/jsUrl.html&chapter=Javascript/js8_web.html#ajaxPassBackJsp

猜你喜欢

转载自blog.csdn.net/mark_to_win/article/details/88682407
今日推荐