weixin_33724046 2013-07-16 21:18 采纳率: 0%
浏览 38

jQuery .post()未执行

I have the following AJAX call through jQuery:

// var upload = some JSON data
$.post('/videos/upload', upload);

And this express.js API part to handle the request:

app.post('/videos/upload', function(request, response) {
    console.log('Request received')
}

However, when .post() is called, it does not seem to be executing. The request is nowhere to be seen in Firebug's Net logger, and the node.js console doesn't log anything, either.

When I type the request directly into the Firebug console, it executes just fine.

Using $.ajax() does not work, either.

Thanks in advance.

  • 写回答

1条回答

  • weixin_33699914 2013-07-17 02:48
    关注

    To troubleshoot and isolate the problem, you need to determine if this is a backend or a frontend problem.

    Backend Check

    Try using something like Postman to hit the endpoint directly with the data that should be posted. If you never get that console.log to execute then you may have some problems with your routes.

    Frontend Check

    If that works, then look at the Network tab of your Dev Tools in Chrome and make sure that the request looks the same as the one you make in Postman.

    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料