spring jquery ajax 無刷新傳遞form整個表單給一個下拉框增長一個選項 並選中

後臺的代碼: 前端

@RequestMapping("/mysaveClient")
public @ResponseBody MapmysaveClient(@ModelAttribute Client
client) {
  Client client=myProjectApplicationService.saveClient(client);
  Map josnMap = new HashMap(); ajax

Map clientMap=new HashMap();
  clientMap.put("id", client.getId());
  clientMap.put("name", client.getname());
List list=new ArrayList();   app

list.add(clientMap);
josnMap.put("clients",list);
return
josnMap;
} ide

ajax的代碼以下:
$("#save_client").click(function(){
          $.ajax({    
   
url: "${pageContext.request.contextPath}/mysaveClient",
data:  $('#form_client').serialize(),
success:function(data){
$("#myWrap").hide();
url

$.each(data.clients, function(index,item){

 $("#projectArtical_client_id").append('<option value='+item.id+'>'+item.specification+'</option>')
spa

if(data == "ok") {
$.messager.alert("提示","權限修改爲功!");
}
}
});
return false;
});  

前端代碼: orm

相關文章
相關標籤/搜索