這是我的Ajax函數的一部分。出於某種原因,我無法弄清楚,我能夠alert() responseText但不能返回 responseText。任何人都可以幫忙嗎?我需要該值用於其他功能。爲什麼我不能從Ajax函數返回responseText?
http.onreadystatechange = function(){
if(http.readyState == 4 && http.status == 200){
return http.responseText;
}
}
參見[ 如何從函數調用函數返回變量onreadystatechange = function() ](http://stackoverflow.com/questions/1955248/how-to-return-variable-from-the-function-called -by-onreadystatechangefunction)和[AJAX]如何從onreadystatechange = function()函數()返回變量(http://stackoverflow.com/questions/290214/in-ajax-how-to-retrive-variable-from - 內 - 的-的onreadystatechange函數)。 – 2010-09-17 02:23:58