Page 1 of 3

Live Updates on Webpage (do I need Ajax)

Posted: Mon 03 Jan 2022 4:55 pm
by SJG1976
Hi all,

Trying to do a few updates to my website.
I'm not sure where to start.

I'd like to get some of the tables updating without having to refresh the pages.

I think I need to use Ajax to get this working, and the. Update pull the values from a variables file that have been uploaded.

I've tried to work our how to do that on some php schools but can't really make head non tail of it.

What I'm trying to do is have a table called.

Current Temp. XXXX. Updated at XXXX

And then get these values change as the real-time text is updated.

I know the Saratoga template do it, but I like to try and do one myself.

Any pointers pleas, and how many files do I need.

Is it a Webpage File
A Variable File
script

Or is more required?

Thanks.

Steve.

Re: Live Updates on Webpage (do I need Ajax)

Posted: Mon 03 Jan 2022 4:59 pm
by dazza1223
yeah use this smb_ajax.js

look on my page

https://www.davisworthing.co.uk/

if u cant do it let me know i see if i have some time to help you

Re: Live Updates on Webpage (do I need Ajax)

Posted: Mon 03 Jan 2022 5:38 pm
by SJG1976
Thanks I'll give that a try.

I'm not the best at coding.
I'm sure if I can get one to update I'll be halfway there.

:)

Re: Live Updates on Webpage (do I need Ajax)

Posted: Mon 03 Jan 2022 5:41 pm
by dazza1223
Yh u should be fine it only span I'd class

Re: Live Updates on Webpage (do I need Ajax)

Posted: Mon 03 Jan 2022 6:47 pm
by SJG1976
Thanks.

Did you get rid of the Tool Tips by the way on the Air Quality?

Re: Live Updates on Webpage (do I need Ajax)

Posted: Mon 03 Jan 2022 7:12 pm
by dazza1223
Yh thank I remove the divs from it and it gone thank you for that !!

Re: Live Updates on Webpage (do I need Ajax)

Posted: Mon 03 Jan 2022 7:32 pm
by SJG1976
That was about my limit.

I'm already stuck on this one as o seem to have an error on the Java script.


I've copied my index.php to index2.php
Which should run the scripts and just change the Current Wind Div.

That's failing so back to drawing board for me.

Re: Live Updates on Webpage (do I need Ajax)

Posted: Mon 03 Jan 2022 7:48 pm
by dazza1223
If u want me to do one for u to get you start it i can help u if u give me ur ftp details but not on here in pm I get one set up for u so u can see how it look

Re: Live Updates on Webpage (do I need Ajax)

Posted: Mon 03 Jan 2022 8:01 pm
by SJG1976
I'm think I'm nearly there but just getting an Error calling the code.

I'm getting the folloiwing Error

Code: Select all

index2:329 Uncaught ReferenceError: initialize is not defined
But I can't see where I've gone wrong

Code: Select all

script type="text/javascript">
//<![CDATA[
			initialize('cumulus.xml',4);
				// ]]>
			</script> 	
I found this Threats as well
viewtopic.php?t=17540

But still not sure where this Error is.

Re: Live Updates on Webpage (do I need Ajax)

Posted: Mon 03 Jan 2022 8:13 pm
by SJG1976
Well I'#ve created a very basic page called egg.php

And that one is working.
So I've probably got a comma in the wrong place somewhere...

Re: Live Updates on Webpage (do I need Ajax)

Posted: Mon 03 Jan 2022 8:15 pm
by dazza1223
Send me the link to ur test site

Re: Live Updates on Webpage (do I need Ajax)

Posted: Mon 03 Jan 2022 8:20 pm
by SJG1976
i somehow missed calling the smb_ajax.js

Adding it into header.php which is called and it's now working.

Just need to add the TAGS now.

Thank for the Help!

https://cm2weather.co.uk/egg.php

Re: Live Updates on Webpage (do I need Ajax)

Posted: Mon 03 Jan 2022 8:21 pm
by dazza1223
No worries 👍

Re: Live Updates on Webpage (do I need Ajax)

Posted: Mon 24 Jan 2022 7:34 pm
by SJG1976
Still doing some expirementinf on WebTags and XML Files.

I've now got some working.

However on an Some Airqiality Tags.

I have the now readings working in a table, but the 1hr 3hr and 24hr don't display any values.

I checked the XML file and the data is there, and all the TAG Names are correct.

Is there a limit on the number of updates that can be done on a page from an XML File?

Thanks Steve.

Re: Live Updates on Webpage (do I need Ajax)

Posted: Mon 24 Jan 2022 7:55 pm
by Mapantz
There shouldn't be a limit, or at least one you would surpass.

Can you post both your XML tags and the ID codes you're calling them with..?