如何在jquery的onchange方法内部调用方法。 下面的代码段:
$("#age").change(function(){
var age=document.appform.age;
if(age.value > 125){
return false;
}
//i have some conditions same as above if condition
filtercustmerdata(age.value);
}
方法是:
function filtercustmerdata(ageval){
alert("Age: "+ageval);// i got this value
//But its not working
$.getJSON("getCustDetails",{dateOfBirth: ageval}, function(data){
alert("data: "+data);
var data2=JSON.stringify(data);
alert("Stringfy data: "+data2);
var str = "";
$.each(data.custdetails, function(key, value) {
var custid=value[0];
var custname=value[1];
str = str+ "<option value="+custid+ ">"+ custname+ "</option>";
});
$("#CustDetails").html(str);//Dropdown
});
}
调用filtercustmerdata
方法,但
$。getJSON
不起作用? 我没有收到错误/异常?
请帮助我!