Note that there are some explanatory texts on larger screens.

plurals
  1. POPage Submission Issue Using AJAX In PHP
    text
    copied!<p>I have a codeigniter application.This is my code in view page.</p> <pre><code>function click_next(){ var aname = $("#txtuname").val(); var apasswd = $("#txtupass").val(); if(aname == ''){ $("#error_val").css("display","block") $("#error_val").html("user name required"); }); }else if(apasswd == ''){ $("#error_val").css("display","block") $("#error_val").html("password required"); }else{ var cnt=$("#alogin").serialize(); $.ajax({ type: "POST", url: "&lt;?php echo base_url();?&gt;index.php/admin/adminLogin/", data: cnt, success: function(msg){ if(msg==1){ window.location="&lt;?php echo base_url();?&gt;index.php/admin/adminHome/"; } else{ $("#error_val").css("display","block") $("#error_val").html(msg); return false; } } }); } </code></pre> <p>} </p> <p>Here <code>alogin</code> is the name of the form and <code>url: "&lt;?php echo base_url();?&gt;index.php/admin/adminLogin/"</code> is the function path in controller page.</p> <p>This is the code in Controller page</p> <pre><code>function adminLogin(){ $this-&gt;adminmodel-&gt;admin_login(); } </code></pre> <p>This is the code in Model page</p> <pre><code>function admin_login(){ $adminname=$this-&gt;input-&gt;post('txtuname'); $adminpass=$this-&gt;input-&gt;post('txtupass'); $adminp_decr=md5($adminpass); $this-&gt;db-&gt;where('varuname',$adminname); $this-&gt;db-&gt;where('varpassword',$adminp_decr); $query = $this-&gt;db-&gt;get('tbladmin'); $row=$query-&gt;row(); if($row==TRUE){ $adminname=$row-&gt;varuname; $id=$row-&gt;intaid; $userdata = array( 'ausername=' =&gt;$adminname, 'aid' =&gt; $id, 'logged_in' =&gt; TRUE ); $this-&gt;session-&gt;set_userdata($userdata); echo 1; } else { echo "Invalid user name or password"; } } </code></pre> <p>But when i click on the Login buttton nothing will happen(the click_next() is called and given admin,admin as username ,password).What is the reason?This is working in our server But not working in client's server?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload