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
| <textarea></textarea>
<script type="text/javascript">
function start(){
var lines = $('textarea').val().split('\n');
var i = 0;
var thread_count = 0;
var div = document.getElementById('logs');
while(i < lines.length) {
if(thread_count < 3){
thread_count ++;
$.ajax({
url: "monscript.php?line="+lines[i],
type: 'GET',
dataType: 'text',
success : function(msg){
div.innerHTML = div.innerHTML + msg + "<br>";
thread_count--;
},
error : function(){
alert("Une erreur Ajax.");
}
});
i++;
}
}
};
</script>
<input type="button" value="run" onclick="start()"/>
<div id="logs">
</div> |
Partager