php 的 ajax 实现
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<input type="button" onclick="test();" value="提交"/>
<script type="text/javascript">
function test(){
var valid = {
username: 'taoge',
password: '123456'
};
$.ajax({
url: 'valid.php',
type: 'get',
data: valid, // 发送的数据
dataType: 'json', // 发送/接收数据的格式
success: function(data){
alert(""+data.username);
},
error: function(data){
alert("xxx"+data);
}
});
}
</script>
===========================
valid.php
相关文档:
工具:myeclipse 6.5
json中文官方:http://www.json.org/json-zh.html
新建项目webs,在WebRoot下新建目录json
xml的解析方式:
------------------------------------------------------------------
1.新建NewFile.xml
<?xml version="1.0" encoding="UTF-8"?>
<userinfo>
  ......
环境:Ajax+JSP,Tomcat5.05
参考:http://www.w3cschool.cn/index-24.asp.htm
文件:testAjax.html
<!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=gb ......
JavaScript 简单理解Ajax异步调用操作的文章。
文章地址:http://www.soaspx.com/dotnet/ajax/javascript/javascript_20090915_349.html
这篇文章是理解Ajax技术的简单例程,挺简明扼要,很容易理解。
Ajax提供与服务器异步通信的能力,借助于Ajax,可以在用户单击按钮时,使用JavaScript和 DHTML立即更新UI,并向服务器 ......
jquery中已经封装了ajax的过程,使用起来很简单:
通过get方式提交:
<html>
<head>
<title>实现服务器时间实时变化</title>
<script language="javascript" type="text/javascript" src="js/jquery-1.3.1.js"></script>
& ......
checkcode.php
====================
<?php
session_start();
$funcs = array('imagecreatetruecolor','imagecolorallocate','imagefill','imageline','imagedestroy','imagecolorallocatealpha','imageellipse','imagepng');
if(!function_exists('ob_gzhandler'))
ob_clean();
//crea ......