解决方案 »

  1.   

    serialize是表单对象的方法,其他对象没有,会报错
    你的输入对象放表单中,jquery选中表单再调用serialize方法
      

  2.   


    我按照你的说法在input的外层设置了一个form,然后把var cont=$("#add0").serialize();写成var cont=$("#form").serialize();
    可是还是不行
      

  3.   

    .....
       data:cont,
    //   dataType:"json",
               success:function(data){
       alert(data);
    //   window.location.href="<?php //echo base_url();?>index.php/member/post/myorder_sub";
       },就可看到问题出在哪里
    ....
      

  4.   

    进入success还是error回调了?进入error输出错误信息看看,error(xhr){  alert('ERROR\n'+xhr.responseText)
    }
      

  5.   

    那就不对了,既然你打算传递 json 数据,怎么能有 html 呢?
      

  6.   

    我说错了,是datatype为text的时候才alert出html,   json时候直接回调error
      

  7.   

    我感觉是你数组当中有空值所以转换成JSON对象时出错了你把数组都加上引号试试
    ("id"=>"$id","title"=>"$title","priceper"=>"$priceper","querity"=>"$querity","price"=>"$price","dw"=>"$dw","parentid"=>"$parentid","image"=>"$image");
      

  8.   

    你的php页面返回值有问题。。指定为json你返回html肯定是error回调自己看下html内容是什么,依据html内容定位你的php页面错误