RE: Ajax Update Help
Hi, What exactly do you mean by '/where/you/send/the/form'? I used the url containing the target div but that might be incorrect. Right now I have this: $(this).ajaxSubmit({ //beforeSubmit: validate, type: 'post', url: 'http://localhost/~Hooman/caroverload/garage', data: queryString, target: '.part_info', //beforeSubmit: preSend, function before you sent but after submit //success: afterEffects, function after sent success }); It's updating the part_info div with the entire garage url page rather than the part list. Dave Maharaj :: WidePixels.com wrote: > > > 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. > > > > > > > > > -- View this message in context: http://www.nabble.com/Ajax-Update-Help-tp25812512p25862549.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 -~--~~~~--~~--~--~---
RE: Ajax Update Help
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 -~--~~~~--~~--~--~---
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 -~--~~~~--~~--~--~---