[eluser]Unknown[/eluser]
Hi Guys,
I'm new to both technologies. I've successfully installed both and can get simple routes working.
Unfortunately I'm stuck on the ajax login CJAX example.
Please see the following simple code:
CJAX CALL:
Code:
<?php
require_once 'ajax.php';
$ajax->login = $ajax->form('ajax.php?ajax_login/handler');
?>
HTML FORM:
Code:
<form>
<div id='err' ></div>
<div class="form-group login-input">
<i class="fa fa-sign-in overlay"></i>
<input type="text" class="form-control text-input" placeholder="Username" id="username" name="username">
</div>
<div class="form-group login-input">
<i class="fa fa-key overlay"></i>
<input type="password" class="form-control text-input" placeholder="Password" name="password" id="password">
</div>
<div class="row">
<div class="col-sm-12">
<button type="submit" id="login" class="btn btn-success btn-block"><i class="fa fa-unlock"></i> Login</button>
</div>
</div>
</form>
CONTROLLER:
Code:
?php
class ajax_login {
function user($username) {
echo "<b>$username</b> is available";
}
function handler($username,$password) {
$ajax = ajax();
$ajax->alert("Server Says...." . $username . ' ---> ' . $password);
}
}
?>
The alert works but I cannot get access to the form elements. They are blank.
Apologies if this is stupid but i'm stuck.
Cheers