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

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) {
            }).error(function (data, status) {

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.




  • ¥15 WPF如何用Chart绘画出Y轴的左边数据
  • ¥15 pycharm无法查看内置代码
  • ¥15 跑hls xfopencv的例程standalone_hls_axi_example出的错误,csim没问题,c synthesis出的错误
  • ¥15 sqlserver update语句逐行生效
  • ¥15 mssql2000游标循环次数对不上
  • ¥20 Windows10系统命令行调用
  • ¥15 php环境如何实现国密SM2相关功能
  • ¥15 关于#单片机#的问题:K210 例程里面提示我iomem.h: No such file or directory
  • ¥15 LSPI算法的大问题
  • ¥15 java导出word 动态填充数据