Ajax的js封装
function send_request(callback, urladdress, isReturnData){
var xmlhttp = getXMLHttpRequest();
xmlhttp.onreadystatechange = function(){
if (xmlhttp.readyState == 4) {//readystate 为4即数据传输结束
try{
if(xmlhttp.status == 200){
if(isReturnData && isReturnData==true){
callback(xmlhttp.responseText);
}
}else{
callback("抱歉,没找到此页面:"+ urladdress +"");
}
} catch(e){
callback("抱歉,发送请求失败,请重试 " + e);
}
相关文档:
在使用JQuery的ajax访问页面时,总是出错,得不到返回的html代码,又不知道出的什么错,百思不得其解
于是就用XMLHTTP去访问,结果也出错,不过能够得到错误原因,然后根据错误因为去网上查,终于得到了答案。。
原来jsp的编码与java的编码不一致
方案①
错误
<%@ page contentType="text/html;charset= ......
ajax弹出提示信息
1、 输入域:
<h2>工具提示</h2>
<hr>
<a href="#" onmouseover="over(0)" onmouseout="out()">物品一</a><br><br>
<a href="#" onmouseover="over(1)" onmouseout="out()">物品二 ......
我用ActiveXObject("Microsoft.xmldom")来装载xml文档时,竟然老是提示装载失败,后来上网搜索了下,说是不能直接包含这5个符号('><&"),必须选用&xx;方式来转义,可我找遍XML也没发现这些。
后来我独行排除,才发现有一个元素的属性值为有“|”,去除后就正常了。我真是觉得奇怪,网上也没有说 ......
前几天在Firebug扩展开发一文中就提到过Firephp这个基于Firebug的插件,通过使用Firephp你可以在Firebug的Console栏中看到要调试的数据,而不影响php程序的正常执行,所以说,这东西对于Ajax开发是很有帮助的!下面一起来看下Firephp的使用方法。
第一步:安装
1.如果你的FireFox没有Firebug这个插件的话,首先要安装Fire ......
http://www.ajaxlines.com/ajax/stuff/article/using_google_is_ajax_search_api_with_java.php
I was rather depressed over a year ago when Google deprecated their SOAP Search API with their AJAX Search API. Essentially Google was saying that they didn want anyone programmatically accessing Google search ......