dongma2388 2012-01-09 01:16
浏览 304


Let's say .. I have the following script in my controller:

 $result= array("Name"=>Charlie Sheen, "Age"=>30); 
 echo josn_encode($result);

And in my view file I have the following java script. Now could you please tell me what exactly to write in the success function of the script below in order to get the "Name" and "Age" displayed in two different divs inside body tag? I have found some tutorials on this but all those are very confusing to me. Could you please kindly help?

Thanks in Advance :)

<script  type="text/javascript">
 $(function(){ // added

            var a_href = $(this).attr('href'); 


     type: "POST",
     url: "<?php echo base_url(); ?>batch/get_info",
     data: "id="+a_href,
     success: function(server_response){
                                                  //What exactly to write here
                                            }); //$.ajax ends here                          
                                                return false    

    });//.click function ends here

  }); // function ends here                        

  • 写回答




      • ¥15 使用DWY100k数据集对UEA进行测试,出现报错:IndexError: index 125000 is out of bounds for axis 0 with size 95500
      • ¥15 前端vue实现根据图片url生成pdf文件
      • ¥15 RfidReader资源Q个
      • ¥20 user-agent是否是唯一的,有没有可能相同
      • ¥15 关于#开会#的问题,如何解决?(语言-c++)
      • ¥15 关于#二十四点问题#的问题
      • ¥15 运行kitex的demon出错(求大家解决)
      • ¥15 开发一个类似 typora 这样的软件需要多少钱?
      • ¥15 clearcase7.0安装包
      • ¥15 断点回归模型月度核密度检验不连续