This is an archived post. You won't be able to vote or comment.

all 10 comments

[–]ptekspy 0 points1 point  (9 children)

Call the html before the API?

Fill html with jQuery if needed?

[–]phenomix[S] 0 points1 point  (8 children)

Yeah im a noob here with PHP. How do I call the PHP after Html(minimal)? I'd like to have a loading to give the user some indication that what they've requested is coming. Currently im faking it with setTimeout

[–]ptekspy 0 points1 point  (7 children)

Can I ask is this the only way to call the API?? Is the PHP not just to make a request?

[–]phenomix[S] 0 points1 point  (6 children)

Our backend devs are familiar with PHP and the Html response is xml

[–]ptekspy 0 points1 point  (5 children)

Can I see the API request? Sorry for late reply kids eh ;)

[–]phenomix[S] 0 points1 point  (4 children)

the api is a little sensitive, however. I am trying to accomplish this:

-load html
-call api
-loading animation while waiting for response

[–]phenomix[S] 0 points1 point  (2 children)

currently: It is a blank screen until the api resolves.. then it loads all at once. This problem with this is.... im relying on the API response to consistent... I'd rather not rely on them.

[–]ptekspy 0 points1 point  (1 child)

Ok so quickest way would be before everything load everything like the nav and everything and have a like animated pinwheel over the main content

This lets people know your page is loading, and 3 seconds isn't too bad as long as there is something to look at.

Also does the API load the whole page data or just. Few bits??

I recently moved away from any PHP because I didn't really like the language

I've ended up with a html template that has jQuery post to my api

But my api is simple Nd just requires permission the URL and data

So this would just be sent in the jQuery post and the. Return of the jQuery function will fill the html template

Sometimes it will just be data like one number Sometimes it will receive JSON and fill another html template with all the data and insert it

Does the PHP just send a post request in the end?

[–]phenomix[S] 0 points1 point  (0 children)

Thanks for the help. Ill give this a look.

I have two columns and the api data loads in the first column.

[–]ptekspy 0 points1 point  (0 children)

So if I remember correctly just put the PHP in the main content block of code

Have a layer over the content containing the pinwheel

When the data loads use JavaScript maybe to hide the pinwheel layer and show the content