CodeIgniter Forums
calling the right method after ajax call - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: calling the right method after ajax call (/showthread.php?tid=15790)

Pages: 1 2


calling the right method after ajax call - El Forum - 02-16-2009

[eluser]stoefln[/eluser]
[quote author="pistolPete" date="1234726403"]Another thought:
Why do you have to respond with the updated image list?
You could only respond with (e.g.) a JSON "true"/"false" success message, then the ajax script would react and reload the image list by directly calling the appropriate controller function.[/quote]
No bad idea. but i would have to make 2 requests instead of one.
Anyway- thanks for your thoughts.


calling the right method after ajax call - El Forum - 02-16-2009

[eluser]obiron2[/eluser]
I agree with PistolPete.

Refresh the browser once Ajax has confirmed tha action was successful.

Deleting the image and refeshing the screen are two different functions. The refresh function could be potentially called from a number of places. (add an image, change an image name etc.)

You could do this as a pass through request, but it is easier to manage as single actions.

Alternatively you could flash the current page to the cookie and refresh from there.


calling the right method after ajax call - El Forum - 02-16-2009

[eluser]stoefln[/eluser]
[quote author="obiron2" date="1234808729"]
Alternatively you could flash the current page to the cookie and refresh from there.[/quote]
could you explain this a bit more in detail?