I have the next HTML form:
<form name="register" method="post" action="register.php" >
<fieldset>
<legend>Register</legend>
<input type="hidden" name="regform" value="true" />
<label for="username">Username:</label>
<input type="text" name="username" id="username" />
<br />
<label for="email">Email:</label>
<input type="text" name="email" id="email" />
<br />
<label for="password1">Password:</label>
<input type="password" name="password1" id="password1" />
<br />
<label for="password2">Password:</label>
<input type="password" name="password2" id="password2" />
<br />
<?php
$config = new Config();
$publickey = $config->getCaptchaPublicKey();
echo recaptcha_get_html($publickey);
?>
</fieldset>
<input type="submit" value="Register!" />
What I'd like to do, is that when the user presses the submit button, i send the data from the forms via AJAX and verify them. But I was wondering how I update the recaptcha? I can verify it in my PHP script, and echo a new one included with the error. But how do I send this back to the client and let javascript (jQuery) replace the old reCAPTCHA with the new?
Hope someone can help me with this.
Greets,
Luxo
PS: Should I use a javascript encryption to encrypt the passwords before sending to the server?