可能有人問我這樣的問題。但是,我找不到任何解決方案。基於jQuery模糊檢查並將結果打印到codeigniter中的視圖
ProfileEditor.php(控制器)
方法1:
public function modify_personal_information() {
$this->data['userinfo'] = $this->personal_information_of_mine($userid);
$this->load->view('layouts/header', $this->data);
$this->load->view('profile/personalinformation', $this->data);
$this->load->view('layouts/footer', $this->data);
}
方法2:
public function check_url_if_exists() {
$newportalurl = $this->uri->segment(2);
$this->results = $this->profile_model->checknewportalurl($newportalurl);
if ($this->results == 1) {
$this->status['status'] = 1;
$this->status['msg'] = 'This name is available. Thanks.';
} else {
$this->status['status'] = 0;
$this->status['msg'] = 'This name is not available. See suggestions.';
}
$this->load->view('profile/layouts/availiability', $this->status);
//or echo json_encode($this->status);
}
簡檔/ personalinformation.php(視圖)
與表單<div id="urlsuggestions"></div>
簡檔/佈局/ availiability.php(視圖) 我在哪裏印刷其中我從check_url()
功能越來越
ajax.js消息(AJAX )
$('#newportalurl').blur(function() {
var fval = $(this).val();
var ifexists = fval.toLowerCase().replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '');
$.ajax(baseurl + "check/"+ifexists, function(data) {
//i tried following things
//alert(window.location);
//$('#msgbox').html(data.msg).show().addClass('alert-success').delay(2000).fadeOut();
//$('#urlsuggestions').load(window.location + 'modifypersonalinformation #urlsuggestions');
});
});
現在,我試圖加載到personalinformation視圖消息。我做錯了什麼,或者做什麼程序?我實際上想知道這個過程如何codeigniter處理它們。
你想在哪裏顯示從ajax返回的值? –
我想顯示價值到'個人信息'視圖 –
你有一個單獨的div來顯示? –