如何从ajax范围中看出这个var(rec_count)?我无法理解ajax范围。谢谢!
function showImage(str){
$.ajax({
url: 'getimg.php',
type: "GET",
data: "q="+str,
dataType: 'json',
success: function(data){
rec_count = data.count;
console.log('inside: ' + rec_count)
}
});
}
$( document ).ready(function(){
$('body').click(function(){
showImage(4);
console.log('outside: ' + rec_count)
});
});