jquery、Ajax、struts的集成
Html代码:
<%@ page language="java" pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>jquery ajax</title>
<link rel="stylesheet" type="text/css" media="screen"
href="screen.css" />
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<script src="jquery.js" type="text/javascript"></script>
<script src="json.js" type="text/javascript"></script>
<script language="javascript">
$(document).ready(function() {
$("#bt").click( function() {
//$.post("send.do?method=query",
{"account":$("#account").val()},
//function(data) {
//})
$.ajax({
type:"post",
url:"send.do?method=query2",
data: "account="+$("#account").val(),//{"account":$("#account").val()},
success:function(data){
var ul = eval('('+data+')');
&n
相关文档:
xmlHttp形式的Ajax:XmlHttp形式的Ajax IBM技术文档库
以下是利用隐藏iframe实现的ajax:
index.htm
<html>
<head>
</head>
<body>
<iframe id="testFrame" frameborder="0" style="width:0px; height:0px;">
</ifra ......
问题:
当用户点击删除按钮时,程序调用Response.write("<script>alert('是否继续')</script>")是页面会弹出错误:
Sys.WebForms.PageRequestManagerParserErrorException:The
message received from the server count not be parsed.Common causes for
this error are when ......
Ajax中send方法参数的使用
一般情况下,使用Ajax提交的参数多是些简单的字符串,可以直接使用GET方法将要提交的参数写到open方法的url参数中,此时send方法的参数为null。
例如 :
var url = "login.jsp?user=XXX&pwd=XXX";
xmlHttpRequest.open("GET",url, ......
//ajax 获取数据
//脚本
var showResp=0;
function GetXmlHttpObject(handler)
{
var objXmlHttp = null;
if (document.all)//!window.XMLHttpRequest
{
// 创建IE中的XMLHttpRequest对象“XMLHTTP”
var clsids = ["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.5.0","Msxml2.XMLHTTP.4.0","Msxml2.XMLHTTP. ......