[eluser]minerbog[/eluser]
Hi Peeps,
Come up against a problem today that has taken me ages to find let alone workout!
Basically I have a JQuery model form for login, and then use JQuery .submit() function to submit the form (code below). However, when I then use the input->post function to get the posted data it always returns false as if no data has been posted.
Please please help if you have come across this becuase I really can't see why??
View File:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--Head Section-->
<html>
<head>
<title>Login</title>
<link rel="stylesheet" href="http://localhost/accounting.site/style.css" />
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/blitzer/jquery-ui.css" />
<link rel="icon" href="http://localhost/my.site/img/icons/favicon.ico" type="image/x-icon"/>
<link rel="shortcut icon" href="http://localhost/my.site/img/icons/favicon.ico" type="image/x-icon" />
[removed][removed]
[removed][removed]
</head>
<body>
<style type="text/css">
#container {
margin: 10px;
border: 1px solid #D0D0D0;
-webkit-box-shadow: 0 0 8px #D0D0D0;
margin: 50px;
}
h3 {
text-align: center;
padding: 10px;
font-size: 14px;
}
p {
margin: 12px;
}
</style>
[removed]
$(document).ready(
function() {
$( "#login-dialog" ).dialog({
draggable: false,
resizable : false,
modal : true,
buttons :
{ "Login" : function() { $('#login-form').submit(); } }
});
}
);
[removed]
<form id="login-form" method="post" action="login/now">
<div id="login-dialog" title="Login">
<p>Username:<input name="user" type="text" /></p
><p>Password:<input name="pass" type="password" /></p>
</div>
</form>
<noscript>
<div id="container">
<h3>Ajax and Javascript are required to run this application. Please see the <a href="#">FAQ</a> for more details as to why.</h3>
</div>
</noscript>
</body>
</html>
Controller:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Login extends CI_Controller {
public function index()
{
$this->load->view('v_login');
}
public function now()
{
$username = $this->input->post('user');
if ($username === false)
{
echo 'No Data';
}else{
echo $username;
}
}
}
/* End of file */
/* Location: ./application/controllers/login.php */