同一套源码。
在lnmp下,一切正常。但是部署到Windows下的wamp套件下,就有如下问题。
控制台报错 DELETE net::ERR_CONNECTION_RESET。
这个是怎么回事呢?
使用的 sweetalert.min.js
代码如下:
<script>
$(document).ready(function()
{
$("[data-toggle='delete']").click(function(){
var agreement_id = $(this).data("agreement_id");
swal({
title: "确定要删除么?",
text: "删除合同会把相关的单据记录,付款记录一起删除!",
type: "warning",
showCancelButton: true,
confirmButtonClass: "btn-danger",
confirmButtonText: "确定删除",
cancelButtonText: "取消",
closeOnConfirm: false
},
function(){
var data="_token=9sceTN60vWYI8CWh35959hH2Vm2t2kP94Kn4LCY7";
$.ajax({
type:"DELETE",
url:"purchase_agreement/"+agreement_id,
data:data,
success: function (data) {
setTimeout(function () {
swal({
title: data.title,
text: data.msg,
type: data.type
}, function () {
window.location = data.location;
});
}, 100)
}
})
}
);
})
})
</script>
找到问题了。是服务器禁止了delete方法。