Something like this:

$('#GaragePartAddfrompartlistForm').bind('submit', function() {
                        
var queryString = $('#GaragePartAddfrompartlistForm').formSerialize();
                                
                        $(this).ajaxSubmit({
                                //beforeSubmit: validate,
                                type:                   'post',
                                url:
'/where/you/send/the/form',
                                data:                   queryString,
                                target:
'#IWantToUpdateThis',
                                //beforeSubmit: preSend, function before you
sent but after submit
                                //success:      afterEffects, function after
sent success
                });
                        
                        
                return false;
                }); 

Target is the DIV id you want to update,

Hope that gets you started.

Dave

-----Original Message-----
From: hahmadi82 [mailto:hahmad...@gmail.com] 
Sent: October-11-09 5:46 AM
To: cake-php@googlegroups.com
Subject: Re: Ajax Update Help



Can anyone please help me with this?



hahmadi82 wrote:
> 
> Hi,
> 
> I have a question about how to get a div to update after an ajax form 
> submission.  I have a file index.ctp which displays a list of parts.  
> When you click on "add part", I use:
> 
> $('a.js-ajax').live('click', function() { 
>     $('#ajax-test').load( 
>      $(this).attr('href'), function () { 
>         $(this).fadeIn(300); 
>     }); 
>     return false;
> });
> 
> to load addpart.ctp into index.ctp via ajax.  The addpart.ctp file has 
> a cake FormHelper form and I use:
> 
> $(document).ready(function() { 
>     $('#GaragePartAddfrompartlistForm').ajaxForm(function() {
>          alert("Part Added!");
>     });
> });
> 
> to submit that form via ajax/Jquery Form Plugin 
> (http://malsup.com/jquery/form/).
> 
> So inside index.ctp, the "part" is added with ajax (not causing page 
> to
> reload) however, I have no idea how to get ajax to update the part 
> list div inside my indext.ctp after addpart.ctp is loaded and 
> submitted. Can someone please describe the best strategy for this?  
> Please note that the part list div has a lot of php in it and its 
> imperative I reconstruct the div with the php code.  I was hoping to 
> dynamically show the part list, with the new part, without reloading 
> the page. Any help would be much appreciated. Thanks.
> 

--
View this message in context:
http://www.nabble.com/Ajax-Update-Help-tp25812512p25841483.html
Sent from the CakePHP mailing list archive at Nabble.com.





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

Reply via email to