Here: $("#report_here").load("/admin/reports/statistics_report/", { // Parameters sent go here }, finished()
"finished()" is suppose to be "finished", without the parenthesis. On Jul 28, 4:18 am, "chris.j.p...@googlemail.com" <chris.j.p...@googlemail.com> wrote: > Hi, > > I have a function that uses the ajax load function to post off some > parameters and fill a div with the returned content after a db query > has been run to create it. This all works fine, however I would like > to be able to rplace the div with a loading graphic whilst the content > is generated. > > I assumed this was done by placing the graphic at the start of the > function, then using a callback function to remove it and display the > actual data once it has been fully generated... > > However when I trey to implement this I am getting a strange result in > that the callback fires before the content is generated. So my loading > graphic disapears and then the content appears sometimes 10 seconds > later. > > How can I ensure the call back only executes once the new content is > ready to be displayed ?? > > here's my code ... > > function get_report() > { > // Hide #report_here div and show loading graphic here ... > > $("#report_here").load("/admin/reports/statistics_report/", > { > // Parameters sent go here > }, finished() > ); > > function finished() > { > // Hide loading graphic and show #eport_here div here ... > > } > > Any ideas where Im going wrong ??? > > Many thanks > > Chris P