js error ajax Uncaught TypeError: Cannot use 'in' operator to search for 'length' in

js error ajax Uncaught TypeError: Cannot use 'in' operator to search for 'length' in_第1张图片
image.png

js error ajax Uncaught TypeError: Cannot use 'in' operator to search for 'length' in_第2张图片
image.png

原因是ajax的书写不准确:dataType,一定要大写。否则ajax不生效,即输出类型有误

$.ajax({
                url:"{:U('Goods/getAttributeByTypeUpd')}",//请求哪个地址
                data:{'type_id':type_id,'goods_id':goods_id},//条件值
                datatype:'json',//服务器返回类型
                type:'get',//以什么方式过去的
                success:function(msg){
                    //遍历msg,获得其中的数据,再和tr/td等标签组合显示到页面上
                    var s = "";

你可能感兴趣的:(js error ajax Uncaught TypeError: Cannot use 'in' operator to search for 'length' in)