hgc-ghc
Good Good Study!!! Day Day Up!!!
posts - 40,comments - 3,trackbacks - 0
简洁实用的ajax封装 
ajaxjavascript .
/**
ajax封装
*/
ygsoft_test_script_helper.ajax=function(method,url,data,func)
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function ()
{
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
{
    //返回后处理
    func(xmlhttp.responseText);
         }
         }
xmlhttp.open(method, url, true);
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlhttp.send(data);
}
posted on 2013-04-11 10:43 宏才 阅读(183) 评论(0)  编辑  收藏 所属分类: ajax

只有注册用户登录后才能发表评论。


网站导航: