【发布时间】:2010-09-17 02:15:15
【问题描述】:
这是我的 Ajax 函数的一部分。由于某种我无法弄清楚的原因,我能够alert() responseText 但不能return responseText。有人可以帮忙吗?我需要在另一个函数中使用该值。
http.onreadystatechange = function(){
if( http.readyState == 4 && http.status == 200 ){
return http.responseText;
}
}
【问题讨论】:
-
请参阅 [如何从 onreadystatechange=function() 调用的函数中返回变量](stackoverflow.com/questions/1955248/…) 和 [在 AJAX 中如何从 onreadystatechange = function () 内部检索变量](@987654322 @)。
标签: javascript ajax return alert responsetext