All pastes #90216 Raw Edit

Someone

public text v1 · immutable
#90216 ·published 2006-07-17 13:54 UTC
rendered paste body
function testing() {
                        string = "bla=bla&bla=bla";
			xhSend4(string);
			if (resposta == "1") {
                                code, code, code...
			}
			else if (resposta == "2") {
                                code, code, code...
			}
			else if (resposta == "3") {
                                code, code, code...
			} else {
                                code, code, code...
			}
}
function xhSend4(string){
	function createXMLHttpRequest() {
		try{ return new ActiveXObject("Msxml2.XMLHTTP"); }catch(e){}
		try{ return new ActiveXObject("Microsoft.XMLHTTP"); }catch(e){}
		try{ return new XMLHttpRequest(); }catch(e){}
		alert("XMLHttpRequest not supported");
		return null;
	}
	var xhReq = createXMLHttpRequest();
	xhReq.open("post","index.php",true);
	xhReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xhReq.onreadystatechange = function do_readyStateChange() {
		if (xhReq.readyState == 4) {
			resposta = xhReq.responseText;
			alert(resposta);
			return resposta;
		}
	}
	xhReq.send(string);
}