【发布时间】:2011-11-25 19:29:18
【问题描述】:
考虑这段代码sn-p:
$('#selectone').change(function(){
var amount;
$.get('search.php', {search:'units'}, function(result){
//this will return only one or zero for me.
amount = result;
})
if(amount>0)
{
alert('This option has been selected, please select another one');
}
})
我的变量amount 总是会出现undefined。如何修复或重构?
【问题讨论】: