On May 15, 2009, at 10:14 AM, l00ser wrote:

> The problem here is that when I click on RemoveCourse link, it fires
> this function, makes Ajax.Update call - return SUCCESS code, BUT NO
> OUTPUT ! I went through everything I can to check code, but it works
> fine }even tried it without ajax - with classic form submit).
>
> This function has to return updated list of courses (minus one user
> has just deleted by clicking on DELETE inside <a>).
>
> Guys, if anyone may HELP me out, I would be forever gratefull !!! Is
> there for e.g. any limitations to number of Ajax calls inside one
> file, or other limitations I am not looking at ?
>
> Again thanks very much - I am looking for any help!!


I'm not following your PHP code here that well, but I have a different  
suggestion. Rather than reloading the entire list, try removing the  
element that's been deleted using Prototype locally (not bothering the  
database for a completely new list).

So your list would look like this:

<ul id="list_id">
<li id="li_23">Some Text <span class="delete">remove</span></li>
<li id="li_25">Some Text <span class="delete">remove</span></li>
<li id="li_24">Some Text <span class="delete">remove</span></li>
<li id="li_28">Some Text <span class="delete">remove</span></li>
</ul>

And your script:

$('list_id').observe('click',function(evt){
        var elm = evt.element();
        if (elm.hasClassName('delete'){
                evt.stop();
                var id = elm.up('li').id.split('_')[1];
                new Ajax.Request('handler.php',{
                        parameters:{'id':id,action:delete},
                        onSuccess: function(transport){
                                elm.up('li').remove();
                        }
                });
        }
});

This decouples your HTML view from the database a little bit, but if  
you were to refresh the page after a successful delete, you would see  
the same thing anyway, so there's no real difference from a practical  
standpoint. The benefit comes when you are performing this operation  
on a thirty-screen-tall list of elements -- you no longer have to wait  
for the entire list to come back to the screen, or for the browser to  
re-paint it.

Walter

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to