码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2015-10-28 12:20:50      阅读:151      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!