Ajax實現模態框的呼叫與資料刪除
阿新 • • 發佈:2019-02-02
$("#btDelete").click(function () { //Modal frame if (id == null) { $("#myModalLabel").html('ERROR'); $("#ModalLabel").html('Please input hotel name!'); $('#DeleteModal').modal({ backdrop: 'static' }) return false; } else { //Delete data $.ajax({ type: "DELETE", url: _url + "/" + id, dataType: "json", success: function (data) { window.location.reload(); console.log('success,'); }, error: function () { console.log('fail,'); } }) return false; } });