2009年11月24日 星期二

[jquery] ajax success 返回值不能 被儲存.

 var r = '';
        $.ajax({
            type: "POST",
            url: "webservice/DataService.asmx/GetAccount",
            data: "{AccountNo: '" + Code +"' }",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            //async: false, //假設沒有這行
            success: function(msg){
            if (msg.length > 0) { r = msg; }
            }
        });
        return r;
記得加加看這一行喔. async: false,

【下列文章您可能也有興趣】

沒有留言: