I have been at this for hours now. Pulling my hair out.
I have a standard php page that has an onunload event on it. The
onunload event sends a xmlhttprequest that triggers a database update,
for simplicity lets say it updates a table:
UPDATE testtable SET testfield = '".$_GET['rand']."' where id = 1
This works just fine.
Then the next page you navigate to is supposed to call the testfield
from the database and it should display the newly updated value. It is
not. If you refresh the next page again you now get the correct newly
inserted value.
Does the onunload event prefetch the next page prior to executing the
onunload function???
Anyone have any ideas?? I cant find anything in the archives about
this.
Thanks. 7 2919 tg****@gmail.co m wrote: I have been at this for hours now. Pulling my hair out.
I have a standard php page that has an onunload event on it. The onunload event sends a xmlhttprequest that triggers a database update, for simplicity lets say it updates a table: UPDATE testtable SET testfield = '".$_GET['rand']."' where id = 1
This works just fine.
Then the next page you navigate to is supposed to call the testfield from the database and it should display the newly updated value. It is not. If you refresh the next page again you now get the correct newly inserted value.
Does the onunload event prefetch the next page prior to executing the onunload function???
Anyone have any ideas?? I cant find anything in the archives about this.
Thanks.
My guess is that the SELECT statement from the second page is received
a few milliseconds after the UPDATE statement.
You could loop the SELECT until it gets 1 result, (also limit it to
like 20 tries or something so it doesn't go forever)
i have an alert statement after the update on the initial page so that
is not the issue as i can see that the value is being updated
correctly. but the next page still has the old value.
it is very strange. tg****@gmail.co m wrote: i have an alert statement after the update on the initial page so that is not the issue as i can see that the value is being updated correctly. but the next page still has the old value.
it is very strange.
Is there only one link that goes to the next page, or can a differant
function be run when x is clicked, then have the function forward the
person to the next page after the XMLRequest Success code is returned?
If this works, then it has something to do with the onunload event.
I figured out the issue. when onunload is executed the browser has
already called the new requested page (it has not rendered it yet - but
it has put it in its memory). therefore the value is still the old
one.
I guess we are back to the drawing board. tg****@gmail.co m said the following on 2/1/2006 5:54 PM:
Please quote what you are replying to.
If you want to post a followup via groups.google.c om, don't use the
"Reply" link at the bottom of the article. Click on "show options" at
the top of the article, then click on the "Reply" at the bottom of the
article headers. I figured out the issue.
Would the issue be you not quoting what you are replying to?
when onunload is executed the browser has already called the new requested page (it has not rendered it yet - but it has put it in its memory). therefore the value is still the old one.
I guess we are back to the drawing board.
onbeforeunload can be your friend.
onclick can also.
--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Thank you you are a genious. onbeforeunload. Why isnt this function
talked about more. This works EXACTLY as I want it to.
Thank you!!!
Randy Webb wrote: tg****@gmail.co m said the following on 2/1/2006 5:54 PM:
Please quote what you are replying to.
If you want to post a followup via groups.google.c om, don't use the "Reply" link at the bottom of the article. Click on "show options" at the top of the article, then click on the "Reply" at the bottom of the article headers.
I figured out the issue.
Would the issue be you not quoting what you are replying to?
when onunload is executed the browser has already called the new requested page (it has not rendered it yet - but it has put it in its memory). therefore the value is still the old one.
I guess we are back to the drawing board.
onbeforeunload can be your friend. onclick can also.
-- Randy comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/ tg****@gmail.co m said the following on 2/3/2006 2:25 AM: Thank you you are a genious. onbeforeunload. Why isnt this function talked about more. This works EXACTLY as I want it to.
Please don't top-post either. It makes following a conversation difficult.
onbeforeunload isn't talked about a lot because of support, or lack of,
for it in different browsers.
--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: kaeli |
last post by:
Hey guys,
This error occurs ONLY in Netscape 7.0. Not in 7.1. So, I think it's a
bug. Buuuut...
Has anyone had this problem or know of a fix?
When attempting to have an onunload function set with "window.onload=",
the error comes up
"permission denied to set property window.onunload"
|
by: TDonohue |
last post by:
I am trying to kill a cookie using onUnload if a user leaves the site
or closes the browser window so someone else can't get a person's
session.
Does anyone know if there's a way to check where the window is going
before it gets there?
Many thanks in advance.
-Ted
|
by: Laurent |
last post by:
I am trying to use the onunload event to know when the user closes a
popup by receiving a request on the web server.
I have a main page from where the user opens a popup. What I want is
when the user closes the popup, it sends a request to my web server
(GoAhead) using the onunload event, then closes the popup.
For the moment, this what i have: when the user closes the popup, I
use the onunload event to open a different popup (by this...
|
by: Andrew Poulos |
last post by:
In a frameset I have this:
window.onload = function() {
frames.onunload = function() {
alert('I'm going now');
}
}
when frames unloads I'm expecting the alert to be called but it never
does. If, instead, I put this into frames it does call the alert:
|
by: Matt Kruse |
last post by:
I'd like to test for Opera8.00's missing setRequestHeader method before
actually instantiating the object. For example, this works in firefox:
if (XMLHttpRequest.prototype.getRequestHeader) { ... }
It causes an error in Opera8.00. In fact, doing
typeof(XMLHttpRequest.prototype) returns 'undefined' in Opera8.00. I'm not
sure how Opera is actually implementing the XMLHttpRequest object, but I
suppose it's not a native object that can be...
| |
by: Elizabeth Harmon |
last post by:
Good Evening,
I am new to the XMLHTTPRequest Object and it's use but i am doing pretty
good with it since it's realtively simple?
I am having one problem in using a Get method.
I am requesting an aspx file that contains some controls, intersoft Web
Combo to be exact. This control is a drop downlist control that renders it's
contents in an XML file structure. When i do a
XMLHTTPRequest("GET",URL,true), the response text is sent back...
|
by: geevaa |
last post by:
http://www.phpbuilder.com/columns/kassemi20050606.php3
XMLHttpRequest and AJAX for PHP programmers
James Kassemi
Introduction:
Although the concept isn't entirely new, XMLHttpRequest technology is
implemented on more sites now than ever. Compatibility is no longer an
issue (IE, Mozilla and Opera all support it), and the benefits to
using it are amazing. There are too many PHP programmers avoiding any
|
by: acoder |
last post by:
Problem
onload and onunload events do not fire when going back, forward or refreshing the page
Browser
Opera
Example
Any code using onload or onunload, e.g.
window.onload = init; where init() is a function which initialises some variables (for example).
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |