Note that there are some explanatory texts on larger screens.

plurals
  1. POsymfony 1.4 and jquery. How to pass variable to jquery function?
    primarykey
    data
    text
    <p>I have the template indexSuccess.php with an AJAX function:</p> <pre><code>&lt;script type="text/javascript"&gt; jQuery(document).ready(function(){ jQuery('#test&lt;?php $mensajes-&gt;getIdmensajes() ?&gt;').click(function(){ jQuery('#contenido&lt;?php $mensajes-&gt;getIdmensajes() ?&gt;').load(this.href); return false; }); }); &lt;/script&gt; &lt;h2&gt;Listado de mensajes emitidos&lt;/h2&gt; &lt;h3&gt;En orden cronológico inverso (más nuevo primero)&lt;/h3&gt; &lt;table id="enviados" width="60%" border="1" cellpadding="8"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;Fecha Creación&lt;/th&gt; &lt;th&gt;Contenido del mensaje&lt;/th&gt; &lt;th&gt;Destinatarios&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;?php foreach ($mensajess as $mensajes): ?&gt; &lt;tr&gt; &lt;td width="10%" align="center"&gt; &lt;?php echo date('d/m/Y', strtotime($mensajes-&gt;getFechaalta())) ?&gt;&lt;/td&gt; &lt;td bgcolor="&lt;?php echo $mensajes-&gt;getColores()-&gt;getCodigo() ?&gt;"&gt;&lt;?php echo $mensajes-&gt;getCuerpo() ?&gt;&lt;/td&gt; &lt;td width="20%" id="contenido&lt;?php echo $mensajes-&gt;getIdmensajes() ?&gt;"&gt; &lt;a id="test&lt;?php echo $mensajes-&gt;getIdmensajes() ?&gt;" href="&lt;?php echo url_for('mensajes/receptores?idmensajes='.$mensajes-&gt;getIdmensajes()) ?&gt;"&gt;Ver receptores&lt;/a&gt; &lt;/td&gt; &lt;/tr&gt; &lt;?php endforeach; ?&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre> <p>I want to pass the value $ message-> getIdmensajes () to the AJAX function. I will have a different ID for each row, but this does not work. But the function works well when I set the value. For example: jQuery ('# test24') and jQuery ('# contenido24') works well for the value Idmensajes=24 . How do I pass the value $ message-> getIdmensajes () to AJAX function?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload