Jump to content

Recommended Posts

For a start, I know absolute 0 about AJAX. I know just about enough JavaScript to scrape by. Soon, I will rectify this; but right now, I need a starting point. So, here it is. If I understand correctly, AJAX should be able to do this. My query is this:

 

Say, I have a code, that writes to a file. Above this code, is a window that displays everything in the file. How do I get the window to be updating all the time, so, say, the person who writes to that file can a) see his own replies, and b) see everyone else's.

Link to comment
https://forums.phpfreaks.com/topic/72348-live-update-using-ajax/
Share on other sites

just to explain what ajax does i'll give a simple description.

 

ajax means you use javascript to call an external serverside(php page prob in your case) to be executed.

this happens withoutout leaving the current page your one(refreshing).

It is possible to update parts of your DOM html for instance a layer.

 

What you are looking for is probably a script that refreshes a part of your HTML periodically. The data has to be fetched using php

Try this as a guide, www.w3schools.com/ajax

It is a really good starters guide!

 

I've found that the best way to do script AJAX, at least for me anyways, is to script the PHP aspect of it first. Once you have the server doing what you want it to do with the inputed data, It is a simple matter of using JavaScript to send the data rather than refreshing the page.

 

My advice to you is to start simple though. First, make a PHP script echo a word. Then use a simple button to call the word on command. Then use that exact same script and make a box so that you can input data to be displayed on command. I would also strip back all of the HTML and make it as simple as you can.

 

Good luck!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.