$("#modal").find(".btn-primary").unbind("click").click(function(){ var title = $("#modal").find("input[name=title]").val(); var intro = $("#modal").find("input[name=intro]").val(); var params = { "title":title, "intro":intro } $.ajax({ method: 'put', url: '/teachroom/'+id, data: params, success: function(data){ if(data){ $("#modal").modal("hide"); }else{ layer.alert("操作失败,请稍后重试!"); } } }) })