Ajax的post方法的使用
刚开始学Ajax,看到很多网上的代码都用Get方法提交参数,Tomcat默认ISO编码实在是让人头痛,对付乱码我都是用过滤器做字符编码过滤的,Get方法过滤器监听不到,所以我一直喜欢使用Post方法,下面对Ajax Get和Post方法做一对比
GET:
view plaincopy to clipboardprint?
<mce:script type="text/javascript"><!--
var xmlHttpRequest;
function createXMLHttpRequest(){
try
{
// Firefox, Opera 8.0+, Safari
xmlHttpRequest=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttpRequest=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlHttpRequest=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
&
相关文档:
1,本例子实现一个Ajax更改数据的例子
如图:
1,新建xml文件;其内容如下:
<?xml version="1.0" encoding="utf-8"?>
<userinfo>
<user>
<id>I</id>
<name>wtq</name>
<password>123456</password>
<phone>0595-8553 ......
以后说明就写在这里了,该控件只当是练手 我把说明一起打包了 不过还是在这里而在贴出来 我有空的时候就会扩展其他功能了
高手就可以飘过了... 每次更新我都会把原来的控件一起打包 文件可能越来越大,呵呵 欢迎交流
Ax控件用于ajax请求
支持浏览器 火狐 IE 等...
控件参数
_Async 是否同步 true为异步 fals ......
其实ajax的东西不是很熟悉,而且对于javascript这样零碎的语言实在是很抗拒。于是过去一直都逃避它,迫于项目的压力,不得已惟有硬碰硬了。为了快速上手,之前做了几个小实验,代码实在太多了。幸好struts2提供了一些ajax的简易实现。
跟网上所有的教程一样,先从最简单的开始吧~
在头结点加上<s:head theme="ajax"/&g ......
在C#中
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Script.Services;
using System.Collections.Generic;
using System.Collections;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.Ba ......