On Tue, Sep 14, 2010 at 1:23 PM, cricket <[email protected]> wrote:
> On Tue, Sep 14, 2010 at 1:17 PM, Tomfox Wiranata
> <[email protected]> wrote:
>> wow, i guess that is it....
>>
>> how do i initialize it?
>
> Create a function that sets the event handler. Call it on page load,
> as well as in your 'success' callback for the AJAX routine.


Here's a basic example:

/* called on page load
 */
$(function()
{
        /* initialise upload form
         */
        initUploadForm();
        
        // other stuff
}

function initUploadForm()
{
        $('a.DeleteUpload').click(function(ev)
        {
                ev.preventDefault();
                
                $.ajax({
                        url: $(this).attr('href'),
                        success: function(html)
                        {
                                // reload the div
                                // ...
                                
                                /* initialise event handlers
                                 */
                                initUploadForm();
                        }
                                
                });
        }
}

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to