JQuery中如何使用事件来出发Ajax
$(document).ready(function(){
$("input[name='customer_name']").keydown(function(e){
if(e.keyCode==13){
search();
}
});
$("input[name='customer_role']").keydown(function(e){
if(e.keyCode==13){
search();
}
});
});
function search(){
var url ='<%=searchCustomerURL %>';
var customerName = $("input[name='customer_name']").val();
var customerRole = $("input[name='customer_role']").val();
$.get(url, {customer_name:customerName,customer_role:customerRole}, function(response) {
if (response.length > 0) {
//$('#<portlet:namespace/>reportTips').html(treeNode.name);
$('#<portlet:namespace/>reportListBox').empty().html(response);
}
});
}