Why isn't this ajax form working? function ga_script_script_question($form, &amp;$form_state) {
    $form['question'] = array(
        '#type' =&gt; 'fieldset',
        '#title' =&gt; t('Question'),
        '#collapsible' =&gt; FALSE, 
        '#collapsed' =&gt; FALSE, 
        '#prefix' =&gt; '&lt;div id="question-wrapper"&gt;',
        '#suffix' =&gt; '&lt;/div&gt;',
    );

    if(isset($form_state['storage']['myflag'])) {
        $form['question']['new_thing'] = array(
            '#markup' =&gt; "new thing",
        );
    }

    $form['question']['original_thing'] = array(
        '#markup' =&gt; "original thing",
    );

    $form['next_question'] = array(
        '#type' =&gt; 'submit',
        '#value' =&gt; t('Next question'),
        '#submit' =&gt; array('ga_script_script_next_question'),
        '#ajax' =&gt; array(
            'callback' =&gt; 'ga_script_script_callback',
            'wrapper' =&gt; 'question-wrapper',
        ),
    );

    return $form;
}

function ga_script_script_next_question($form, $form_state) {
    $form_state['storage']['myflag'] = 1;
    $form_state['rebuild'] = TRUE;
}

function ga_script_script_callback($form, &amp;$form_state) {
    return $form['question'];
}


When I submit this form, nothing happens. I get the little spinning thing next to my submit button, but the contents of question-wrapper are unchanged. It seems like the form is not getting rebuilt.

What am I doing wrong?
I just realised I was missing the &amp; in my submit function. It should have looked like this:

function ga_script_script_next_question($form, &amp;$form_state) {
}


It works fine now.