weixin_33698043 2015-01-07 16:06 采纳率: 0%
浏览 920

jQuery $ .post 500错误

I am trying to do $.post call but I keep getting a 500 error and I dont know why,

$http.post('/api/report/action/post', JSON.stringify($scope.user))
            .success(function (data) {
                alert('sucess');
            }).error(function (data, status) {
                alert('error');
            });

the url is correct, is there something wrong with the way I am passing in the data?

  • 写回答

1条回答 默认 最新

  • weixin_33716557 2015-01-07 16:24
    关注

    Error 500 is an error on server side.

    It usually states that the code that is executed by your call to /api/report/action/post has failed.

    It could fail for a lot of thing, of course. Maybe you are passing the wrong parameters, or in the wrong encoding. Or maybe just it has a bug.

    The steps I'd take to debug this would be:

    1) Check what happens when I execute the call directly. Is there an error? Do this error throws more light about the problem?

    2) If there is no error calling the method directly I'd check if my call is correct. Am I passing the correct url? And the correct parameters? Is the data being passed the expected data? It's encoding as the server expects it?

    3) If the direct call works and my remote call seems to be correct I'd try to use a tool like fiddler to check all the steps and data in the call/response data transmission, and try to detect where things get tricky.

    Hope it helps.

    评论

报告相同问题?

悬赏问题

  • ¥30 Matlab打开默认名称带有/的光谱数据
  • ¥50 easyExcel模板 动态单元格合并列
  • ¥15 res.rows如何取值使用
  • ¥15 在odoo17开发环境中,怎么实现库存管理系统,或独立模块设计与AGV小车对接?开发方面应如何设计和开发?请详细解释MES或WMS在与AGV小车对接时需完成的设计和开发
  • ¥15 CSP算法实现EEG特征提取,哪一步错了?
  • ¥15 游戏盾如何溯源服务器真实ip?需要30个字。后面的字是凑数的
  • ¥15 vue3前端取消收藏的不会引用collectId
  • ¥15 delphi7 HMAC_SHA256方式加密
  • ¥15 关于#qt#的问题:我想实现qcustomplot完成坐标轴
  • ¥15 下列c语言代码为何输出了多余的空格