【发布时间】:2011-10-09 20:10:11
【问题描述】:
我不知道为什么在下面的 js 代码中,没有 html 代码的警报是空的,我的视图有 html 代码,而 my_class 对其他控制器有效,当我收到警报时,这意味着它是真正的 js 代码,但获取 php 代码的数据没有 html。我该怎么办?
function guide_show($offset = 0) {
$find = $this -> input -> post('find');
$where = "name LIKE '%$find%' OR phone LIKE '%$find%' OR mobile LIKE '%$find%' OR address LIKE '%$find%' OR date_submit LIKE '%$find%' OR useradmin_submit LIKE '%$find%'";
$table = "guide";
$url_pag = "admin/submits/guide_show";
$order = "id";
$data = $this -> my_class -> show($where, $table, $url_pag, $order, $offset);
$this->load->view('admin/guide_show', $data);
}
jQuery:
$.ajax({
type: "POST",
dataType: "html",
url: url,
data: dataString,
cache: false,
success: function (html) {
alert(html)
},
"error": function (x, y, z) {
// callback to run if an error occurs
alert("An error has occured:\n" + x + "\n" + y + "\n" + z);
}
})
这里是 My_class(库):http://pastebin.com/6DxjmBFC
这是我在视图中的 htm 代码(guide_show):http://pastebin.com/mtubjzvB
【问题讨论】:
-
你已经看过 HTTP 请求了吗?在 Firefox 中,您可以使用 Firebug。其他浏览器已内置开发者工具来监视 HTTP 请求。
-
@AliciaCibrian,在 Chrome 中使用开发者工具。快捷键:Ctrl+Shift+I
标签: php javascript jquery codeigniter