Ajax callback returns value but wrapper isn't filled I'm stuck because whatever I do my wrapper is never filled with my callback, any idea ?


  $form['show_liste_produits'] = array(
   '#type' => 'button',
   //'#attributes' => array('onclick' => 'return (false);'),
   '#value' => t('Lister les produits'),
   '#name'  => 'awesome-button',
   '#ajax' => array(
      'callback' => 'stockerAll',
      'wrapper' => 'listeProduits',
      'method'   => 'replace',
      'effect'   => 'fade',
    ),
  );

  $form['listeProduits'] = array(
    '#type' => 'container',
    '#attributes' => array(
      'id' => array('listeProduits'),
    ),
  );

function stockerAll($form, $form_state){
 return 'test';
}

Thank you in advance !

EDIT:
In fact in the network tab I get this, maybe the selector isn't working ?
Moreover, my empty container isn't displayed after page load actually, maybe is it the source of the problem ?
Edit your code into the code below:

 $form['show_liste_produits'] = array(
     '#type' =&gt; 'submit',   
     '#value' =&gt; t('Lister les produits'),   
     '#ajax' =&gt; array(
         'callback' =&gt; 'stockerAll',
         'wrapper' =&gt; 'listeProduits',      
     ),
);

$form['listeProduits'] = array(
    '#type' =&gt; 'container',
    '#attributes' =&gt; array('id'=&gt; 'listeProduits'),         
);


If it doesnt work,make sure first if stockerAll is called. Insert watchdog('test','test'); in the stockerAll function . After doing so, run the program, check your drupal database, particularly the watchdog table and check whether 'test' is in the latest log.

function stockerAll($form, $form_state){
    watchdog('test','test');
    return 'test';
}


If stockerAll is called, clear cache of the browser to make sure the updated code is the one executing. Else, there's something wrong with the way you invoke your function.