jquery表单异步提交

 <script type="text/javascript">
    $("input").blur(function(){
         var $formData=$("#frm");  //表单异步提交
            console.log($formData);
             $.ajax({
                url : "/search/topicSearch_getSearchTables.action",
                type : "post",
                data:$formData.serializeArray(),
                dataType : 'json',
                success : function(res) {
                    var jsonArray=res;
                    var cacheTables_count=jsonArray.length;
                    $('#cacheTables_count').html("");
                    $('#cacheTables_count').html(cacheTables_count);
                    $('#cachetables').empty();
                     for(var i=0;i<jsonArray.length;i++){
                        $('#cachetables').append('<li style="background-color:white;cursor:default;"><a href="#" style="background-color:white; color:black;cursor:default;">'+jsonArray[i].zhName+'</a></li>');
                    } 
                },
                async : true
            });
        
    });
    
    </script>

猜你喜欢

转载自blog.csdn.net/qq_39716220/article/details/81365396