mercredi 2 juillet 2014

How can i use jquery using the MVC?


Vote count:

0




this is my SignupController.php code:



<?php class SignupController extends \Phalcon\Mvc\Controller {

public function indexAction()
{

}

public function registerAction()
{

$user = new Users();

//Store and check for errors
$success = $user->save($this->request->getPost(), array('name', 'email'));

if ($success) {
echo "k";

} else {
echo "Sorry, the following problems were generated: ";
foreach ($user->getMessages() as $message) {
echo $message->getMessage(), "<br/>";
}
}

$this->view->disable();
} }


then this is my index.php inside my signup folder:



<html>
<head><title>trial</title> <script type="text/javascript" src="public/js/jquery.js"></script>
<script type="text/javascript" src="public/js/ext.js"></script>
<body>
<div id="signup/-feedback"></div>
<form id="signupForm" name="loginForm" method="post" action="signup/register">
<table width="300" border="0" align="center" cellpadding="2" cellspacing="0" >
<td colspan="3" align="center" height="50"><strong>Registration form</strong></td> <br />
<tr>
<th>Name:</th>
<td><input name="name" type="Variable" class="input2" id="name" /></td>
<div id="underInput" />
</tr>
<tr>
<th>Email:</th>
<td><input name="email" type="Variable" class="input2" id="email" /></td>
</tr>

<td>&nbsp;</td>

<td><input type="submit" name="Submit" value="Register" />
<input type="reset" name="Submit2" value="Clear" /></td>
</tr>
</table>

</body>
</html>


this is my ext.js:



$('signupForm').submit(function(){
var name = $ ('#name').val();
$('#signup_feedback').html('Registration success', + name + 'has been registered. You may now do 10 cartwheels XD');
});


what should i do?




Darren

2,097

asked 31 secs ago






Aucun commentaire:

Enregistrer un commentaire