写错Ajax返回数据的Json字段名造成无法进入success和error函数

写js调用接口时,因为复制了ajax代码又改为调用另外一个接口,从而造成写错json返回数据的栏位名,造成无法进入success和error函数。

例子:

$.ajax({

        type: "POST",

        url: "./getpiaojiquery.php",

        timeout:6000,

        async: false,

        contentType: "application/json;charset=UTF-8",

        data: guidstr,

        dataType: "text",

        success:function(msg){

            msg = eval("(" + msg + ")");

            if(msg.httpstatus!=200){      <-这里误写了。其实这个接口返回的是 msg.code

             }else{

                msgout_list = msg;

                ret = 1;

                $("#errormsg").html("查询成功...");  

                return 1;

            }

        },

        error:function (msg) {

            alert("失败!");

            return -1;

        }

    });

最近更新

  1. TCP协议是安全的吗?

    2024-01-01 20:18:01       16 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-01-01 20:18:01       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-01-01 20:18:01       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-01-01 20:18:01       18 阅读

热门阅读

  1. LeetCode //C - 2215. Find the Difference of Two Arrays

    2024-01-01 20:18:01       41 阅读
  2. Redis常见面试题

    2024-01-01 20:18:01       31 阅读
  3. 深入理解与运用C语言中的Continue关键字

    2024-01-01 20:18:01       29 阅读
  4. 人工通用智能AGI

    2024-01-01 20:18:01       35 阅读
  5. 2023.12.30 libstdc++.so.6 GLIBCXX_3.4.32 not found

    2024-01-01 20:18:01       40 阅读
  6. git 查看最新commit提交时间(具体到时分秒)

    2024-01-01 20:18:01       37 阅读
  7. CAN,SPI,IIC,USART每帧的组成

    2024-01-01 20:18:01       36 阅读
  8. LeetCode976. Largest Perimeter Triangle

    2024-01-01 20:18:01       29 阅读