weixin_33690367 2015-07-23 08:20 采纳率: 0%
浏览 20

ajax用库调用ajax

I'm newbie in PHP Codeigniter.. I try to call ajax within library but the library can't be open... this is my code :

This is the view 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();
}

My controllers 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);
}

My problem is when I call user_ticket, I can't get this:

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

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

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 西门子S7-Graph,S7-300,梯形图
    • ¥50 用易语言http 访问不了网页
    • ¥50 safari浏览器fetch提交数据后数据丢失问题
    • ¥15 matlab不知道怎么改,求解答!!
    • ¥15 永磁直线电机的电流环pi调不出来
    • ¥15 用stata实现聚类的代码
    • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
    • ¥20 docker里部署springboot项目,访问不到扬声器
    • ¥15 netty整合springboot之后自动重连失效
    • ¥15 悬赏!微信开发者工具报错,求帮改