|
|
|
|
var count=0;
load();
alert(count);
//выводит 0
function load() {
var ob = new JsHttpRequest();
ob.onreadystatechange = function() {
if (ob.readyState == 4) {
count=ob.responseJS.usrs_list.length;
alert(count);
//выводит 5
}
}
req.open('POST', 'index.php', true);
req.send( { sid: top.sid } );
}
|
Как сделать что бы Count изменился ? | |
|
|
|
|
|
|
|
для: GreyPilgrim
(01.05.2009 в 16:47)
| | Путь решения очень прост:
var count=0;
alert(count);
//выводит 0
Load();
alert(count);
//выводит 2
function Load() {
var ob = new JsHttpRequest();
ob.onreadystatechange = ChangeCount;
req.open('POST', 'index.php', true);
req.send( { sid: top.sid } );
}
function ChangeCount() {
if (ob.readyState == 4) {
count=2;
}
}
|
| |
|
|
|