Giter Club home page Giter Club logo

ajaxbynana's Introduction

ajaxBynana

ajax function createXMLHttpRequest(){ try{ //throw("error");//手动抛出一个错误, return new window.XMLHttpRequest();//上面手动抛出了错误,所以该句不执行 }catch(e){//捕捉错误 try{ //throw("error"); return new ActiveXObiect("MSXML2.XMLHTTP.6.0"); }catch(e){ try{ //throw("error"); return new ActiveXObiect("MSXML2.XMLHTTP.3.0"); }catch(e){ try{ //throw("error"); return new ActiveXObiect("MSXML2.XMLHTTP"); }catch(e){ if(window.confirm("浏览器版本太低,是否下载新版本")){ window.location.href="http://download.firefox.com.cn" } } } } } } function aja(){ var _ajax = createXMLHttpRequest(); if(_ajax){ _ajax.onreadystatechange = function(){ if(_ajax.readyState == 4) { alert(_ajax.responseText); } } _ajax.open("get", "text1.txt", true);

		_ajax.send(null);
		}
}

function ajax2(){
	var _ajax = createXMLHttpRequest();
	if(_ajax){
		_ajax.onreadystatechange = function(){
		if(_ajax.readyState == 4) {
			alert(_ajax.responseText);
		}
		}
		_ajax.open("get", "ajax1.html", true);

		_ajax.send(null);
	}

}
function ajax3(){
	var _ajax = createXMLHttpRequest();
	if(_ajax){
		_ajax.onreadystatechange = function(){
		if(_ajax.readyState == 4) {
			alert(_ajax.responseText);
		}
		}
		_ajax.open("get", "a.js", true);

		_ajax.send(null);
		}

}
function demo(_obj){
	alert(_obj);
}
window.onload=function(){
	aja();
	ajax2();
	ajax3();
	ajaxRequest("post","text2.txt",null,demo,true);
	ajaxRequest("post","text1.txt",null,function(data){
		alert(data);
	},true);
}

ajaxbynana's People

Contributors

qimengke avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.