MVC路线被忽略但在路线调试器中正确
因此,我在URL上有一些jQuery发布,但升至404
createOrder: function () {
return fetch('/paypalcreate', {
method: 'POST',
body: JSON.stringify({
data: contactjson,
cartsessionid: CartSessionId
}),
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
}).then(function (res) {
return res.json();
}).then(function (data) {
orderId = data.d.Result.orderID;
return orderId;
});
,但要挖掘代码 - 如果我使用Route Bugger核对,它显示了哪些规则和路由应该处理
,这是我的路线:
和我的控制器如下:
真的很困惑,以至于为什么它以404的形式出现,因为路线调试器显示了正确指定路线,并且控制器看起来正确,但是什么都没有
想法?
So I have some jquery posting to a url but comes up as 404
createOrder: function () {
return fetch('/paypalcreate', {
method: 'POST',
body: JSON.stringify({
data: contactjson,
cartsessionid: CartSessionId
}),
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
}).then(function (res) {
return res.json();
}).then(function (data) {
orderId = data.d.Result.orderID;
return orderId;
});
But digging into the code - If I check with route bugger it shows what rules and routes should handle it
and here is my route:
and my controller is as below:
So really confused as to why its coming up as 404 as the route debugger shows the route is specified correctly and the controller looks correct, yet nothing is working
any ideas please?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
找到答案,更改了控制器调用并删除了“公共共享”
现在读取:
async函数paypalCreate(byval data作为字符串,byval cartsessionId作为字符串)为threading.tasks.tasks.tasks.tasks.task(of Object)
控制器现在可以随路由和路由和路由来拾取呼应
Found the answer, changed the controller call and removed 'Public Shared'
Now just reads:
Async Function PayPalCreate(ByVal data As String, ByVal cartsessionid As String) As Threading.Tasks.Task(Of Object)
controller now picks up witht he route and respinds