以下のコントローラコードはログインできません。エラーの どれも問題が何であるかを私は、コントローラにポスト値を渡すためにbelow.howとしてajax.scriptを通じてポスト値を送信示す表示ページとしてコードの下にはアヤックスユーザー名とパスワードはajaxを使用してログインします。ログインできません
public function loginn()
{
$email=$this->input->post('email');
$password=$this->input->post('password');
//$this->load->library('form_validation');
$this->form_validation->set_rules('email', 'Email or number', 'required|min_length[10]|max_length[30]');
$this->form_validation->set_rules('password', 'password', 'trim|required|min_length[4]|max_length[40]');
if ($this->form_validation->run() && $this->Login_model->login($email, $password)) {
$this->welcome();
}
else {
$this->form_validation->set_message('check_database', 'Invalid username or password');
$this->index();
}
}
を通じて呼び出す方法を理解することはできません取得しますajaxを使って
<script type="text/javascript">
$(document).ready(function(){
$("#fpassf").click(function(){
//e.preventDefault();
var email = $("#email").val();
var password= $("#password").val();
$.ajax({
type: "POST",
url: "<?php echo base_url() ?>"+"Index.php/Login_cntrl/loginn",
data: {email:email,password:password},
success:function(data)
{
alert('Successfully login');
},
error:function()
{
alert('fail');
}
});
});
});
以下 enter image description here
問題でどのようなあなたのjqueryのコード – Shayan
を入れて?エラー?問題?実際の行動と期待される行動詳細が不足しているため投票を閉じる –
AJAXレスポンスとPHPエラーをチェックしてください。多分、それはあなたが何が問題かを理解するのを助けるでしょう。 – mi6crazyheart