1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| <html>
<script src="prototype.js"></script>
<head>
</head>
<body>
<div id="resultat">No request launched</div>
</body>
<script type="text/javascript">
function lit(tt){
alert(tt.responseText);
}
function state1(){
$('resultat').innerHTML = 'launching first state';
var path = "url";
var url = "parametres";
var opt = { method: "get", asynchronous: false,onComplete:lit,onSuccess:state2};
tmp = new Ajax.Request(path+url,opt);
}
function state2(){
$('resultat').innerHTML = 'second state launched';
var path = "url";
var url = "parametres";
var opt2 = { method: "get", asynchronous: false,onComplete:lit};
tmp = new Ajax.Request(path+url,opt2);
}
state1();
</script>
</html> |
Partager