首页 > Web开发 > 详细

JQuery中如何使用事件来出发Ajax

时间:2015-10-28 12:19:01      阅读:171      评论:0      收藏:0      [点我收藏+]

$(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);
            }
        });
        
        
    }

JQuery中如何使用事件来出发Ajax

原文:http://www.cnblogs.com/airycode/p/4916629.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!