Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/12/2011, 02:07
Avatar de repara2
repara2
 
Fecha de Ingreso: septiembre-2010
Ubicación: München
Mensajes: 2.445
Antigüedad: 14 años, 5 meses
Puntos: 331
Ajax recarga toda la pagina en cada click

Hola foreros, intento hacer una llamada Ajax en Symfony 1.4 pero cada vez que se hace click se regarga toda la página. Hay unos option, al hacer click sobre uno de ellos se envia en form:

Código PHP:
Ver original
  1. <?php use_helper('Javascript'); ?>
  2. <div class="frameLeftContent"><?php echo image_tag("buttons"); ?><br />
  3. <?php echo form_remote_tag(array(
  4.     'loading' => 'Loading',
  5.     'complete' => 'Complete!',
  6.     'update'   => 'frameRightContent',
  7.     'url'      => 'main/getFlash',
  8. ), array("id" => "getFlash")); ?>
  9. <select name="file_selection"
  10.         style="width: 320px; height: 620px; overflow: hidden; margin-top: 10px;"
  11.         multiple="multiple" />
  12.         <?php foreach($list as $cat => $file):?>
  13.         <optgroup label="<?php echo $cat;?>">
  14.         <?php foreach($file as $object):?>
  15.                 <option
  16.                         onclick="changeImage('<?php echo $object->getDescription(); ?>'); document.getElementById('getFlash').submit();"
  17.                         value="<?php echo $object->getConvertedName(); ?>"><?php echo $object->getPptName(); ?></option>
  18.                         <?php endforeach; ?>
  19.         </optgroup>
  20.         <?php endforeach; ?>
  21. </select>
  22. </form>
  23. </div>
  24. <script>
  25.         function changeImage(name)
  26.         {
  27.         document.getElementById('windowStatusBar').innerHTML = "Showing File: " + name;
  28.         return true;
  29.             }
  30.         </script>

La acción es:

Código PHP:
Ver original
  1. public function executeGetFlash()
  2.     {
  3.         $fileName = $this->request->getParameter('file_selection');
  4.         $this->content = 'xxx';
  5.         $this->request->setParameter('content', $this->content);
  6.  
  7.           if ($request->isXmlHttpRequest())
  8.   {
  9.     return $this->renderPartial('main/frameRightContent', array('content' => $this->content));
  10.   }
  11.  
  12.     }
La función isXmlHttpRequest() devuelve siempre false.
JS se carga correctamente.
No hay otros errores de JS.
Nombres elementos, componentes etc, están ok.

Espero que alguien pueda echar una mano, gracias, salu2
__________________
Fere libenter homines, id quod volunt, credunt.