Note that there are some explanatory texts on larger screens.

plurals
  1. POproblems with .live and ajax
    text
    copied!<p>I have this code:</p> <pre><code>$(document).ready(function() { $(".vote, .vote1").click(function() { var id = $(this).attr("id"); var name = $(this).attr("name"); var dataString = 'id='+ id ; var parent = $(this); if(name=='mod_up') { $(this).fadeIn(200).html('&lt;img src="dot.gif" align="absmiddle"&gt;'); $.ajax({ type: "POST", url: "mod_up_vote.php", dataType: "xml", data: dataString, cache: false, success: function(xml) { //$("#mod-pregunta").html(html); //$("#mod-respuesta").html(html); //parent.html(html); $(xml).find('pregunta').each(function() { var id = $(this).attr('id'); var pregunta = $(this).find('preguntadato').text(); var respuesta = $(this).find('respuestadato').text(); var votoup = $(this).find('votoup').text(); var votodown = $(this).find('votodown').text(); var id_pregunta = $(this).find('id_pregunta').text(); var id_respuesta = $(this).find('id_respuesta').text(); $("#mod-pregunta").html(pregunta); $("#mod-respuesta").html(respuesta); $(".vote1").html("&lt;a href=\"\" title=\""+ id_pregunta + "-"+ id_respuesta + "-1\" class=\"vote1\" id=\""+ id_pregunta + "-"+ id_respuesta + "-1\" name=\"mod_up\"&gt;Aceptar&lt;/a&gt;"); }); } }); } }); }); </code></pre> <p>With this link, It update the database and show a new question and answer.</p> <pre><code>&lt;a href="" title="up" class="vote1" id="&lt;?php echo $id_pregunta."-".$id_respuesta; ?&gt;-1" name="mod_up"&gt;Accept&lt;/a&gt; </code></pre> <p>But if I click one more time in Accept's link only shows the gif () And doesn't update the database and doesn't show the new question&amp;answer.</p> <p>How must I use .live()? or .delegate()? or what i need?</p>
 

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