jQuery .post() not executing
jQuery .post() not executing
我通过jQuery调用了以下AJAX:
// var upload = some JSON data
$.post('/videos/upload', upload);
这个express.js API部分处理请求:
app.post('/videos/upload', function(request, response) {
console.log('Request received')
}
然而,当调用.post()时,它似乎并没有执行。在Firebug的网络记录器中看不到该请求,node.js控制台也不记录任何内容。
当我直接在Firebug控制台中键入请求时,它执行得很好。
使用$.ajax()也不起作用。
提前谢谢。
要排除故障并隔离问题,需要确定这是后端问题还是前端问题。
后端检查
尝试使用Postman之类的方法直接使用应该发布的数据到达端点。如果您从未执行过console.log
,那么您的路由可能会出现一些问题。
前端检查
如果有效,请在Chrome中查看开发工具的"网络"选项卡,并确保该请求与您在Postman中发出的请求相同。
相关文章:
- jQuery is not loaded
- AngularJS JSON not arriving php
- $rootScope not working
- reactRedux is not defined
- jquery ajax success functions not executing
- rails jquery ajax request not executing
- Javascript not executing google chrome extensioin
- SoundCloud JS SDK get handler not executing
- Office 365 on iPad - SP.SOD.executeFunc not executing functi
- Webview javascript not executing
- Rails 3.2.2 not executing rjs
- setTimeout not executing
- jQuery .post() not executing
- DataTables Ajax not executing
- Cordova / Phonegap -- jquery not executing Javascript on <
- Angularjs $timeout not executing
- Delphi, EmbeddedWB/TWebbrowser - jQuery not executing
- JS not executing
- Jquery else not executing
- e.preventDefault not executing