JS:
$("#addOrganizationSure").unbind('click').bind('click', function () { var
organNameText= $("#organName").val() var id = viewModel5.id; var options = $(
"#selectorg option:selected"); if (options.text() == '新增一个机构') { id = 0; } if (
organNameText== '' || organNameText == "机构名称") { alert("请输入机构名称") } else { $.
ajax({ async: false, url: "/user/addOrganization", type: "GET", data: { id: id,
organName: viewModel5.organName, organSite: viewModel5.organSite, organIntroduce
: viewModel5.organIntroduce }, dataType: "JSON", success: function (result) { if
(result != 0) { $("#addOrganization").modal("hide"); window.location.reload(); }
else { alert("失败!") } } }) } })
Html <button type="button" class="btn btn-primary"
id="addOrganizationSure">确认</button>