weixin_33699914 2012-10-10 05:00 采纳率: 0%
浏览 119

AJAX内部服务器错误

I couldnt find out what is the error.

 <script type="text/javascript">
         $(document).ready(function () {
             $("#btnsumbit").click(function (e) {
                 e.preventDefault();
                 $.ajax({
                     type: 'POST',
                     data: '{"username":"' + $("input#txtuser").val() + '","password":"' + $("input#txtpwd").val() + '"}',
                     url: 'http://localhost:53179/hdfcmobile/WebService.asmx/Login_Data',
                     contentType: 'application/json; charset=utf-8',
                     dataType: 'json',

                     success:
                  function (data, textStatus, XMLHttpRequest) {

                      var status = data.Status;
                      alert(data.d);




                  },
                     error:
                  function (XMLHttpRequest, textStatus, errorThrown) {
                      alert(textStatus);
                  }

                 });

             });
         });


    </script>

I am getting 500 internal server error.How to call this webservice.I have passes the method with the url.Thanks for any help...

  • 写回答

1条回答 默认 最新

  • 七度&光 2012-10-10 05:05
    关注

    First thing, the way you are sending is wrong, send it like this

    data:  {
    
        "username": $("input#txtuser").val(),
        "password": $("input#txtpwd").val()
    
    }
    

    Next make sure, url: http://localhost:53179/hdfcmobile/WebService.asmx/Login_Data is returning JSON output.

    评论

报告相同问题?

悬赏问题

  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
  • ¥20 yolov5自定义Prune报错,如何解决?