0
当我在localhost运行应用程序时,它工作正常,但是当我在线运行时,我得到“404页面未找到”。相同的代码是在线和本地的。ajax GET在localhost上运行,但不在线
有Ajax代码:
var FormAll = $("#formPdf");
$.ajax({
type: "GET",
dataType: "json",
contentType: "application/json",
url: "/Objetivo/SendPdf",
data: FormAll.serialize(),
success: function (resultado) {
//do something
},
error: function (jqXHR, exception) {
alert(jqXHR.status);
}
});
还有就是Python代码:
@app.route('/Objetivo/SendPdf',methods=['GET'])
def sendPdf():
try:
##Do Something
except Exception as e:
print(e)
当url:'/ Objetivo/SendPdf'显示404错误时,它与ajax无关。这可能是因为您的服务器上不存在该路线。请检查您的服务器是否构建正确,以及您是否在服务器端脚本中指定了正确的CORS标头。 –
路线存在 –
如果存在,则不会抛出404错误。在这里你有http错误代码列表:http://www.restapitutorial.com/httpstatuscodes.html –