如何通过ajax检索从控制器发送到视图的数组?

i am new in jquery and ajax. I am really cant figured it out how can i show the array result send from the controller from json_encode. Below is the code in controller:

Controller

            $totaldata['data'] = array('totalscore' =>$totalscore,'totalwicket' =>$totalwicket,'totalover' =>$totalover,'totalextra' =>$totalextra);

            $this->output->set_output(json_encode($totaldata));

Jquery

  $.ajax({
               url: 'xxxxxxxxx',
               type : 'POST',
               data:{
                        xxxx : arrayValue,
                        id    : matchid,
               },
               success: function(dataone){
                  //$('.addmatchsuccess').html(dataone).show();

                    //setTimeout(function() {location.reload() },3000);
               }
            });

Problem I want to get each array value to be placed in a input field in view ...which i couldnt figured out still how it gonna work. Please any help will be appreciated. Thank You

查看全部
duannian7116
duannian7116
2015/12/02 04:23
  • codeigniter
  • php
  • ajax
  • javascript
  • jquery
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

3个回复