How to display a newly created node (created using a form) in the view using ajax (without page reload)? I have created a "Share update" form using form API. Below the form, I am displaying a view "feeds" of all the published nodes of content type "updates". On submit, the form saves the data entered in the form as a node of content type "updates". It reloads the page and displays the recently saved node in the view below the form.

I want the node to appear in the view list without page reload. How to do that? 

My form API code looks like this -

function add_update_page($form, &amp;$form_state) {
  $form = array(
   '#prefix' =&gt; '&lt;div id="update-div"&gt;',
   '#suffix' =&gt; '&lt;/div&gt;',
   '#title' =&gt; t('Latest update:'),
   '#description' =&gt; t('Add status update'),
  );

  $form['update'] = array(
    '#title' =&gt; t('Share an update...'),
    '#type' =&gt; 'textarea',
    '#resizable' =&gt; '0',
    '#format' =&gt; 'update_feed_text',
    '#label' =&gt; t('Share an update...'),
  );

  $form['submit'] = array(
    '#id' =&gt; 'update-submit-button',
    '#type' =&gt; 'submit',
    '#default_value' =&gt; t('Share'),
  ); 
  return $form;
}

function add_update_page_submit($form, &amp;$form_state) {
  $update = $form_state['values']['update'];
  $node = new stdClass();
  $node-&gt;type = 'updates';
  node_object_prepare($node);
  $node-&gt;status = 1;
  $node-&gt;uid = $GLOBALS['user']-&gt;uid; 
  $node-&gt;language = LANGUAGE_NONE;
  $node-&gt;created = time();
  $node-&gt;changed = $node-&gt;created;
  $node-&gt;title = 'Automatic status update';
  $node-&gt;body[$node-&gt;language][0]['value']   = $form_state['values']['update'];
  $node-&gt;body[$node-&gt;language][0]['summary'] = "";
  $node-&gt;body[$node-&gt;language][0]['format']  = 'filtered_html';
  node_save($node);
  drupal_set_message($form_state['values']['update']); 
  $form_state['redirect'] = '&lt;front&gt;';
}


I have looked up everywhere, but the proposed solutions are incomplete, making it harder to follow the logic.
As mentioned by wwwWRX you should use the #ajax property for your submit button and with in your function make a few changes. Before that you would want to remove your view from the block because we would be putting that here using code. 

the submit button would become

$form['submit'] = array(
    '#id' =&gt; 'update-submit-button',
    '#type' =&gt; 'submit',
    '#default_value' =&gt; t('Share'),
    '#ajax' =&gt; array(
        'callback' =&gt; 'add_update_page_submit',
        'wrapper' =&gt; 'update-list',
        'method' =&gt; 'replace',
        'effect' =&gt; 'fade',
    ),
  ); 


Add one more element to your form of the type #markup like below

$form['update_list'] = array(
 '#prefix' =&gt; '&lt;div id="update-list"&gt;',
   '#suffix' =&gt; '&lt;/div&gt;',
  '#markup' =&gt; views_embed_view('views-machine-name','block_name', $arg);

);


you should replace views-machine-name with the actual machine name of the view and block_name with the name of the specific block in the view and $arg would be the argument passed to the view which can be left blank if you dont have one. 

with in the function you need to make a few changes towards the end. 

you need to get rid of $form_state['redirect'] = '&lt;front&gt;';

and add

return views_embed_view('views-machine-name','block_name', $arg);


That should do it.