Tag: global variables

在它之外使用ajax respone是否可行?

有data_response在$.post()之外使用data_response方法? 这是我使用的代码的一部分: $.post(‘do.php’, { OP: “news_search”, category: cat_id }, function(data_response){ var response = data_response; //I need to access this variable outside of $.post() } }, “json”); console.log(response); //response is not defined, is what I get for now UPDATE 是否没有办法在全球范围内获得该响应?