I am sorry, I missed that you are trying to use jQuery. I have never used jQuery. I have always delt directly with the builtin ajax related code, which does not have to be loaded. JK > On Sep 8, 2023, at 5:30 PM, Anthony Pulse <inland14@xxxxxxxx> wrote: > > I know it may come as a surprise but this line should work > > <Timed delay="5000" Ajax="url" insert="divTarget"> > > If you need a call back just add the attribute callback="function" wherein the returned info is the parameter. Parameterizing it is taken care of already for you. $ git Clone https://GitHub.com/wise-penny/pipes If you want to see some of this kinda work, go-to g0d.me/pipes > > Get Outlook for Android > From: JEFFRY KILLEN <jekillen@xxxxxxxxxxx> > Sent: Friday, September 8, 2023 8:18:56 PM > To: gordonisnz@xxxxxxxxx <gordonisnz@xxxxxxxxx> > Cc: php-general <php-general@xxxxxxxxxxxxx> > Subject: Re: Ajax query > > You do not need to "load" ajax. The object is built into Javascript. But there a newer versions > that the xmlHttpRequestObject. > > In general, your ajax request must be initiated by a user event such as mouse click or a keydown > event. So that has to be written in. Also there is a sequence for intiating the ajax request that must > be adhered to. THEN, on the server side there has to be PHP or other serverside code to recognize > and handle the request and return a response if there should be one. The last phase if there is a > response expected is for Javascript to handle the response. > > Mostly, the ajax request is done ASYNCRONISTICALLY. That just means that a response will NOT > cause the browser window to reload. So state can be maintained. In technical terms it means that > the request is done outside of the browsers main thread. > > A page initiating the request can process its response. But that is tricky to program. > It essentially means that the PHP that process the request must exist above the > DTD declaration and 'exit' as soon as it completes the request. It must also call > header() and issue a header indicating the type of response: text, json, whatever. > Then it uses print or echo to sent the response body. Then exit must called to prevent > any html from being generated. > > 1 header() > 2 print (or echo) response body > 3 exit > > The newer version of asyncronous requests is more difficult and less intuitive. > > Here is the result of a Google search for Javascript training. > > https://www.google.com/search?client=firefox-b-1-d&q=Javascript+training > > Here is another for mozilla javascript: > https://www.google.com/search?q=mozilla+javascript&client=firefox-b-1-d&sca_esv=563870670&ei=T7X7ZOWYCa-n0PEPr-eMwAg&oq=mozilla&gs_lp=Egxnd3Mtd2l6LXNlcnAiB21vemlsbGEqAggAMggQABiKBRiRAjITEC4YigUYsQMYgwEYxwEY0QMYQzINEAAYigUYsQMYgwEYQzILEAAYigUYsQMYkQIyDRAAGIoFGLEDGIMBGEMyExAuGIoFGLEDGIMBGMcBGNEDGEMyCBAAGIoFGJECMggQABiKBRiRAjIHEAAYigUYQzIEEAAYA0iZ6RxQ0ZAcWKDVHHACeAKQAQCYAYgBoAH4D6oBBDIzLjK4AQHIAQD4AQGoAgrCAgoQABhHGNYEGLADwgIKEAAYigUYsAMYQ8ICDhAAGOQCGNYEGLAD2AEBwgIWEC4YigUYxwEY0QMYyAMYsAMYQ9gBAsICBBAAGEfCAgUQABiABMICCBAAGIAEGLEDwgILEAAYgAQYsQMYgwHCAgcQLhiKBRhDwgILEC4YgAQYsQMYgwHCAgsQLhiKBRixAxiDAcICFhAuGAMYjwEY5QIY6gIYtAIYjAPYAQPCAhYQABgDGI8BGOUCGOoCGLQCGIwD2AEDwgILEAAYigUYsQMYgwHCAg4QLhiABBixAxjHARjRA8ICERAuGIAEGLEDGIMBGMcBGNEDwgIFEC4YgATCAggQLhiABBixA8ICCxAuGIAEGMcBGNEDwgINEC4YigUYxwEY0QMYQ8ICCBAuGLEDGIAE4gMEGAAgQYgGAZAGCLoGBggBEAEYCboGBggCEAEYCLoGBAgDGAo&sclient=gws-wiz-serp > > javascript ajax: > https://www.google.com/search?q=javascript+ajax&client=firefox-b-1-d&sca_esv=563870670&ei=8rj7ZODYHY7G0PEP7JiYyAI&oq=javascript+ajax&gs_lp=Egxnd3Mtd2l6LXNlcnAiD2phdmFzY3JpcHQgYWpheCoCCAAyCBAAGIoFGJECMggQABiKBRiRAjIFEAAYgAQyBRAAGIAEMgUQABiABDIFEAAYgAQyBRAAGIAEMgUQABiABDIFEAAYgAQyBRAAGIAESKmVBVD5pARY9-sEcAh4AZABAJgBcaAB5AmqAQQxNS4xuAEByAEA-AEBwgIKEAAYRxjWBBiwA8ICChAAGIoFGLADGEPCAg4QABjkAhjWBBiwA9gBAcICGRAuGIoFGMcBGNEDGNQCGMgDGLADGEPYAQLCAhAQLhiKBRjIAxiwAxhD2AECwgIHEAAYDRiABMICBhAAGAcYHsICExAAGA0YgAQYsQMYgwEYsQMYgwHCAg0QABgNGIAEGLEDGIMBwgIKEAAYDRiABBixA8ICDRAAGIoFGA0YsQMYgwHCAgcQABiKBRhDwgINEAAYigUYsQMYgwEYQ8ICChAAGIoFGLEDGEPCAgsQABiABBixAxiDAcICDhAAGIoFGLEDGIMBGJECwgILEAAYigUYsQMYkQLCAggQABiABBixA8ICBxAAGIAEGArCAg0QABgWGB4YDxjxBBgKwgIIEAAYigUYhgPiAwQYACBBiAYBkAYRugYGCAEQARgJugYGCAIQARgI&sclient=gws-wiz-serp > > > On Sep 8, 2023, at 4:27 PM, gordonisnz@xxxxxxxxx wrote: > > > > Hello. I'm trying to get a "simple" ajax going, but the half-dozen examples I've tried do not work. > > > > It Should simply run/activate a PHP script every 5 or 10 seconds, then display the output in the specified DIV. > > > > however, when I go to the developer tools, it says there is something wrong with the ajax line > > (and nothing changes on my screen) > > > > > > Stupid query 1: > > <link rel="stylesheet" href="/css/font-awesome.min.css" /> > > > > Do I need to 'load' Ajax somehow - like Javascript ? I do not see this in ANY examples/tutorials I see. > > > > EXAMPLES:- > > > > Here are 2 examples I've tried (apparently these are accepted answers to other peoples queries) > > > > I did the full https://domain.com/rotatestats.php and /rotatestats.php - still same problem. > > > > ONE: > > > > <script type="text/javascript"> > > setInterval(function() > > { > > $.ajax( "/rotatestats.php" ).done(function(res) { <<< PROBLEM LINE > > document.getElementById("rot").innerHTML = res; > > }) > > > > }, > > 3000); > > </script> > > > > ================= > > > > TWO :- > > > > <script type="text/javascript"> > > function updateShouts(){ > > // Assuming we have #shoutbox > > $('#rot').load('rotatestats.php'); << PROBLEM LINE > > } > > setInterval( "updateShouts()", 10000 ); > > </script> > > {/literal} > > <div id="rot"> > > NEW: > > > > </div> > > > > END EXAMPLES > > > > ERROR MESSAGE IN DEVELOPER TOOLS: > > Uncaught ReferenceError: $ is not defined > > at updateShouts (*WORD*:358:5) > > at <anonymous>:1:1 > > > > The WORD is some HTML output I do previous to the script. its NOT part of the script / div.. > > apparently it IS refreshing - which is good, but the output isn't appearing > > > > > > Are these two nearly there? I'm not sure what the problem is with the PHP script. if I go to the script directly, it displays a random number.. (Once I get it going, I'll fix up the script to do what I want. > > > > > > Gordon.