0

我使用 POST 将 name_cust 变量传递给控制器​​(这是有效的),并希望在 html 正文中回显该变量。

在控制器中,

$data['nameCust'] = $this->input->post('name_cust');

在正文 php 中,

<p class="lead">Are you sure want to delete <?php echo $nameCust; ?></p>

当我使用 firebug 签入时,它在 XHR 响应 HTML 中看起来不错,快照位于http://i.stack.imgur.com/JtN8S.png

但是......没有实际的 HTML 响应,快照位于http://i.stack.imgur.com/I4Qvm.png

或者,我错过了什么吗?谢谢

编辑:

class Dbcust extends CI_Controller {

  public function __construct()
  {
    parent::__construct();
    $this->load->model('dbcust_model');
    $this->load->helper('url');
  }

  public function index($page = 'all')
  {
    if(! file_exists( 'application/views/cust/dom/dom-'.$page.'.php' ))
    {
      show_404();
    }    

    switch ($page)
     {
     case 'all':
      $data['cust'] = $this->dbcust_model->get_dbcust();
      break;
     case 'gold':
      $data['cust'] = $this->dbcust_model->get_dbcust_gold();
      break;
     case 'platinum':
      $data['cust'] = $this->dbcust_model->get_dbcust_platinum();
      break;
     case 'diamond':
      $data['cust'] = $this->dbcust_model->get_dbcust_diamond();
      break;
     default:
      break;
    }   

    $data['title'] = ucfirst($page);

    $data['nameCust'] = $this->input->post('name_cust'); // -> Here it is my declaration

    $this->load->view('cust/template/head',$data);
    $this->load->view('cust/template/body',$data);
    $this->load->view('cust/template/foot');
    $this->load->view('cust/dom/dom-'.$page);
  }

和 ajax 调用者:

$.ajax({  
            type: "POST",  
            url: '<?php echo base_url();?>dbcust',  
            data: {name_cust: name_cust},  
            success: function() {

            }
4

0 回答 0