Try something like:

$(".show_subpages").click(function() {
      var $this = $(this);
$.post("/pages/get_subpages", { id: $this.attr("rel") }, function(data) {
           $this.parent().append(data);
       });
       return false;
});

That will preserve the "this" during the ajax call and will append the results to only that item's parent and not to all that match the selector $(".show_subpages").

- Jack

poncjusz wrote:
I'm sure that solution is simple but I can't find it... :/
I'v got such problem:
$(".show_subpages").click(function() {
                $.post("/pages/get_subpages", { id: $(this).attr("rel") },
function(data) {
                        $(".show_subpages").parent().append(data);
                });
return false;
});

I want to add results of ajax query to the link which call the
query... (In example is adding to all with class .show_subpages.

thanks in advance
Tomek



Reply via email to