• 使用ajax,后台传回的数据处理


    使用ajax,后台传到前台的是json数据,但这只是一个字符串的形式,需要进行转换为对象

    转换后再使用$.each()方法进行遍历

    使用alert(typeof  msg) ;  可以查看msg的类型

    success: function(msg){                
                      $.each(JSON.parse(msg),function(index,item){
                          alert(item.DMMC) ;
                      }) ;
                       //var listDq = msg.size() ;
                       
                       //alert(listDq) ;
                       //$("#result").
                       alert(msg) ;
                       show() ;
                     }

     success: function(data) {
                    var obj = eval('(' + data + ')');
                    var code = obj.code ;
                    var msg = obj.msg ;
                    if(code==-1){
                        alert("保存失败!"+msg) ;
                    }
                    else{
                        alert("保存成功!") ;
                    }
                }

  • 相关阅读:
    向IPython Notebook中导入.py文件
    python--时间日期
    python--条件和循环
    python--输入输出
    python--字符串
    python--内置函数
    python--异常
    python--模块
    python--数据结构
    pybrain
  • 原文地址:https://www.cnblogs.com/lly001/p/4349696.html
Copyright © 2020-2023  润新知