Note that there are some explanatory texts on larger screens.

plurals
  1. POCall the ajax function again after Complete function
    text
    copied!<p>I'm trying to re-execute the function with other parameter in the complete callback, but it isn't working as I want. It works well at the first call, but when I call it again, it only alerts the test alert twice and doesn't execute the function again. My intention is to execute the function with another parameter,that is the id of the element every time that the user click on the element. I appreciate if anyone could help me, what should I do? Thanks. =) </p> <pre><code> jQuery(function($){ var load_pages = function($page){ $.ajax({ type : "POST", data : {page_name : $page}, dataType : "html", url : "http://localhost/includes/loadpages.php", beforeSend : function(){ $("#content").addClass("hide"); if($page.substr(0,9) == "categoria"){ $("#content").removeClass("hide"); $("#the-portfolio").remove(); } }, success : function(data){ $data = $(data); if($data.length){ if($page == 'lista_portfolio'){ $(".submenu").append($data); $(".submenu").append('&lt;div class="end"&gt;&lt;/div&gt;'); } else{ if(!$("#content") == false){ $("#wrapper").append('&lt;div id="content"&gt;&lt;/div&gt;'); } $("#content").append($data); $(".foot").animate({bottom: 0},700,'easeOutExpo'); $data.fadeIn(500); } } }, error : function(jqXHR, textStatus, errorThrown) { alert(jqXHR + " :: " + textStatus + " :: " + errorThrown); }, complete : function() { $("#portfolio_categories_list li a").click(function(){ alert("test"); $categoria = $(this).attr("title").split("Ver todos os posts arquivados em "); load_pages("categoria"+$categoria[1]); return false; }); } }); }// end load_pages }); </code></pre>
 

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