Sunday, January 13, 2013

Re: How can I render an element after pageload?

Instead of having your element output the HTML (or whatever the result
is you want), have it instead create the JS code that makes an AJAX
query.

On Sun, Jan 13, 2013 at 5:26 AM, MetZ <metz80@gmail.com> wrote:
> Okei. here goes.
>
> I have an element (test_element.ctp), that perform an API call.
>
> I use a regular: echo $this->element('test_element', array("limit" => 2));
> to load it:
>
> <div id="TheElement">
> <?php echo $this->element('test_element', array("limit" => 2)); ?>
> </div>
>
> So far so good. The element load API call and display data as it should..
>
> Now to my question, HOW can I make a jquery/ajax approach, to display
> loading icon until the API call/rendering inside the element is done, and
> then update the div with the finished data?
>
> So that my website will load everything else on the site and display the api
> data when the element is finished loading in the background??
>
> Now the rest of my website content will need to wait for the element to
> finish talking to the API before displaying the page..
>
> Anyone know of a good approach to this?
>
> Thanks!
> -Tom
>
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> 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+unsubscribe@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
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+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.

No comments: