Javascript同步任务

时间:2013-10-29 18:15:36

标签: javascript

我打电话如下:

BeginGetDashboardsMethod();
alert('Items');

该呼叫链接到那里:

BeginGetDashboardsMethod()
{

var stop = 'false';
alert('1');
try {
    do {
        Service.GetDashboardsMobile("" + curr_cod_user, SuccessGetDashboardMethod, ErrorGetDashboardMethod);
    } while (stop == 'false')
}
catch (e) {

}
function SuccessGetDashboardMethod(result) {
    alert('2');
    stop = 'true';
    json = result;

    json = JSON.parse(json);
    alert('2');
    ListDashboards(json);
}
function ErrorGetDashboardMethod(err) {
    alert(JSON.stringify(err));
}

function ListDashboards(json) {
    alert('3');
    for (var i = 0; i < json.Dashboards.length; i++) {
        if (json.Dashboards.length === 1)
            Items = "[{key:\'" + json.Dashboards[i].OBV_ST_TITULO + "\', title:\'" + json.Dashboards[i].OBV_ST_TITULO + "\'}]";
        else {
            if (i == 0) {
                Items += "[{key:\'" + json.Dashboards[i].OBV_ST_TITULO + "\', title:\'" + json.Dashboards[i].OBV_ST_TITULO + "\'} ";
            }
            else if (i + 1 == json.Dashboards.length) {
                Items += ",{key:\'" + json.Dashboards[i].OBV_ST_TITULO + "\', title:\'" + json.Dashboards[i].OBV_ST_TITULO + "\'}] ";
            }
            else {
                Items += ",{key:\'" + json.Dashboards[i].OBV_ST_TITULO + "\', title:\'" + json.Dashboards[i].OBV_ST_TITULO + "\'} ";
            }
        }

    }
    obj = eval(Items);
}


}

Items变量为null。并且javascript代码没有通过成功函数回调。我需要Item变量值来提醒它。 有人可以帮帮我吗?

0 个答案:

没有答案