ajax用库调用ajax

时间:2015-07-23 08:20:19

标签: php jquery ajax codeigniter

我是PHP Codeigniter的新手.. 我试图在库中调用ajax但是库不能打开... 这是我的代码:

这是视图 user_ticket.php

    <div class="panel panel-default">
        <div class="panel-heading">
            <h4 class="panel-title">
            <a data-toggle="collapse" data-parent="#accordion" href="#five" onclick="Ajax()">Related</a>
            </h4>
        </div>
        <div id="five" class="panel-collapse collapse">
            <div class="panel-body">
                <div id="related"></div>
            </div>
        </div>
    </div>

function Ajax(){
var xmlhttp;
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("related").innerHTML=xmlhttp.responseText;
    }
}
xmlhttp.open("getData",'<?php echo base_url() . "index.php/user/ctr_ticket/related/" . $ticket_id; ?>',true);
xmlhttp.send();
}

我的控制器 ctr_ticket.php

function __construct(){
    parent::__construct();
    $this->load->model("user/mdl_ticket");
    $this->load->library('cso_template', array('templateFile' => 'user/user_template'));
    $this->load->helper('download');
}

function related($ticket_id = 0){
    $data['ticket_id'] = $ticket_id;
    $result = $this->mdl_ticket->get_ticket_data($ticket_id
        , array("customer_name", "customer_phone", "customer_email", "helpcso_ticket.activity_id"));
    $record = $result[0];
    $data['activity_id'] = $record->activity_id;
    $data['customer_name'] = $record->customer_name;
    $data['customer_email'] = $record->customer_email;
    $data['customer_phone'] = $record->customer_phone;
    $this->cso_template->view("user/user_ticket_related", $data);
}

我的问题是当我打电话给user_ticket时,我无法理解:

$this->cso_template->view("user/user_ticket_related", $data);

$this->load->library('cso_template', array('templateFile' => 'user/user_template'));

0 个答案:

没有答案