4
我在嘗試刪除值時收到以下彈出窗口。我正在使用jQuery Ajax刪除值。我使用的編程語言是python2.7和框架的Django 1.3.2嘗試使用jQuery Ajax刪除時獲得警報刪除
我的代碼如下:
$.ajax({
type: "DELETE",
url: window.location.pathname + id + '/data-centers/' + dc,
contentType: 'application/html; charset=utf-8',
data: {
dc : dc,
},
success: function(){
alert("success");
}
etc...
當我確定要刪除我與JavaScript得到以下彈出值他說:
"This web page is being redirected to a new location. Would you like to resend
the form data you have typed to the new location?
而在阿賈克斯頭,我可以看到下面的(它試圖重定向到其他位置,但不知道爲什麼):
Connection Keep-Alive
Content-Encoding gzip
Content-Length 251
Content-Type text/html; charset=iso-8859-1
Date Tue, 27 Nov 2012 13:53:44 GMT
Keep-Alive timeout=5, max=100
Location http://www.test.com/403/test-403.html
Vary Accept-Encoding
Request Headers
Accept */*
Accept-Encoding gzip, deflate
Accept-Language en-us,en;q=0.5
Connection keep-alive
Content-Length 12
Content-Type application/html; charset=utf-8
這隻發生在我嘗試使用DELETE時。
您正被重定向到403(禁止)頁面。我想解決方案是授權您的服務器/應用程序/控制器上的http DELETE動詞 – jbl