Ajax forgot password error syntax : <p>I am having a syntax error for a form I have changed from PHP to using Jquery/Ajax.  I am trying to test if form will work and submit to reset the password.</p>

<p>I keep getting the below error</p>

<p>syntax error, unexpected $end in <b>/home/a4358077/public_html/mod/forgotajax.php
</b> on line <b>38</b><br /></p>

<p>My code is -</p>

<pre><code>&lt;?php
require_once('../inc/autoload.php');
$objForm = new Form();
$objValid = new Validation($objForm);
$objUser = new User();

// forgot password form
if ($objForm-&gt;isPost('email')) {

    $objValid-&gt;_expected = array('email');
    $objValid-&gt;_required = array('email');

    $email = $objForm-&gt;getPost('email');

    if (empty($email) || !$objValid-&gt;isEmail($email)) {
        $objValid-&gt;add2Errors('email');
    } else {

        $user = $objUser-&gt;getByEmail($email);

        if (!empty($user)) {

            if ($objValid-&gt;isValid()) {

                if ($objUser-&gt;forgotUser($user)) {
                    $url = !empty($url) ? $url :  '/?page=forgotsuccess';
                    echo json_encode(array('error' =&gt; false, 'url' =&gt; $url));
            } else {
                $url = !empty($url) ? $url :  '/?page=forgot-failed';
            //$message = 'Error in registration, Please contact administrator'; // failure
            $objValid-&gt;add2Errors('login');
            echo json_encode(array('error' =&gt; true, 'validation' =&gt; $objValid-&gt;_error_messages));
        }
    } else {
    echo json_encode(array('error' =&gt; true));   
}
</code></pre>

<p>I have tried fixing the code but cannot figure out where to either put a curly brace.</p>

<p>Any help is much appreciated. </p>

<p>Thanks</p>
