Welcome Guest, Not a member yet? Register   Sign In
Submit form with Javascript
#1

[eluser]ibnclaudius[/eluser]
I want to login the user without refreshing the page.

So here's is my js:
Code:
$(function() {
$("#submit-login").click(function() {
  var email = $("#input-email").val();
  var password = $("#input-password").val();
  var dataString = 'action='+ action + '&email;=' + email + '&password;=' + password;
  
$.ajax({
  type: "POST",
  url: "form/login",
  data: dataString,
  
  success: function() {
    
   }
});
}
  
  return false;
});
});

He will run this class/method:
Code:
public function login()
{
if ($this->input->server('REQUEST_METHOD') === 'POST')
{
  $data = array('email' => $this->input->post('email'),
    'password' => $this->encrypt->sha1($this->input->post('password'))
  );

  if ($this->mb_auth_lib->login($data))
  {
   echo 'TRUE';
  }
  else
  {
   echo 'FALSE';
  }
}
else
{
  echo 'FALSE';
}
}

If success, how can I read the content of the class/method and proceed if TRUE or FALSE?


Messages In This Thread
Submit form with Javascript - by El Forum - 01-23-2012, 07:55 PM
Submit form with Javascript - by El Forum - 01-23-2012, 08:35 PM
Submit form with Javascript - by El Forum - 01-23-2012, 09:13 PM
Submit form with Javascript - by El Forum - 01-24-2012, 12:21 PM
Submit form with Javascript - by El Forum - 01-24-2012, 12:33 PM
Submit form with Javascript - by El Forum - 01-24-2012, 12:34 PM
Submit form with Javascript - by El Forum - 01-24-2012, 01:02 PM
Submit form with Javascript - by El Forum - 01-24-2012, 01:09 PM
Submit form with Javascript - by El Forum - 01-24-2012, 02:20 PM
Submit form with Javascript - by El Forum - 01-24-2012, 02:59 PM
Submit form with Javascript - by El Forum - 01-24-2012, 04:36 PM



Theme © iAndrew 2016 - Forum software by © MyBB