jqueryUI

一、引进jqueryui包

二、 

        <td align="left">用户名称 &nbsp;&nbsp;
            <input id="queryUserName" type="text"  value="">
       </td>

三、$( "#queryUserName" ).autocomplete({
   source: function( request, response ) {
             $.ajax({
                 url: "/app/userb_getUserName",
                 dataType: "json",
                 data:{
                     item : request.term
                 },
                 success: function( data ) {
                     response( $.map( data, function( item ) {
                         return {
                             value: item.USERNAME
                         }
                     }));
                 }
             });
         },
         minLength: 1,
         select: function( event, ui ) {
             $("#queryUserName").val(ui.item.value);
          
         }
  });

四、String item = this.getRequest().getParameter("item");
       Map<String,Object> params = new HashMap<String, Object>();
       params.put("item", item);
      List list = this.baseService.selectListByIbatis3("UserBaseLineMapper.selectUserName", params);
     JSONArray jsonArray = ListUtil.listToJSONArray(list);
      this.print(jsonArray);

五、完成

 

你可能感兴趣的:(jqueryUI)