为什么我的控制器没有任何价值。请帮忙。
class Welcome extends CI_Controller {
public function index()
{
$this->load->view('welcome_message');
}
public function ajax_process(){
$data = array(
'email' =>$this->input->post('email'),
'password'=>$this->input->post('password')
);
echo json_encode($data);
}
}
**这是我的查看文件:welcome_mesage.php
$(document).ready(function(){
$('#sbtn').click(function(){
var email = $('#email').val();
var password = $('#password').val();
var datas = $('#myform').serialize();
$.ajax({
type: "POST",
url: "http://localhost/codeigniter_testing/index.php/welcome/ajax_process",
data: {email : email, password : password},
success:function(data){
echo data;
}
});
});
});
我的基本网址
$ config [' base_url'] = 'http://localhost/codeigniter_testing/';
答案 0 :(得分:0)
在您的代码中,他们是代码错误
O((n + m) log n)
您已添加success:function(data){
echo data;
}
而不是alert
。
EX:
echo
答案 1 :(得分:0)
试试吧......
<script type="text/javascript">
$(document).ready(function(){
$('#sbtn').click(function(){
var email = $('#email').val();
var password = $('#password').val();
var datas = $('#myform').serialize();
$.ajax({
type: "POST",
url: "http://localhost/codeigniter_testing/index.php/welcome/ajax_process",
data: {email : email, password : password},
success:function(data){
var result=eval(data);
alert(result.email);
}
});
});
});
</script>