Closed Bug 313484 Opened 20 years ago Closed 20 years ago

AJAX/DHTML: page reloads after onclick from button within form

Categories

(Core :: DOM: Core & HTML, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 97829

People

(Reporter: apang, Unassigned)

References

()

Details

Attachments

(2 files)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20051023 Firefox/1.6a1 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20051023 Firefox/1.6a1 Button inside form. Button's onclick calls AJAX function to modify page without reloading. The AJAX function calls XMLHttpRequest using POST. When the onclick returns, the page reloads. Any DHTML changes to the form are thus lost. The server log shows the POST and a subsequent GET for the script (http://www.softwaredevelopment.ca/test.php?xajaxjs=xajaxjs). I assume the page was loaded from the cache. There are two buttons inside a form (labelled "1.Click Me" and "2.CLICK ME"). Two buttons outside the form (labelled "3.Click Me" and "4.CLICK ME"). The buttons inside the form call the same functions as the buttons outside the form, onclick. The buttons outside the form do not exhibit the same behaviour as the buttons inside the form. (Bug also present in Firefox 1.0.7 release.) Reproducible: Always Steps to Reproduce: 1. Load page. 2. Click on "2.CLICK ME". 3. Click through the debug messages to see the DHTML in action and the subsequent page reload. 4. Click on "4.CLICK ME". 5. Click through the debug messages to see the DHTML in action. Observe: the page does not reload. You can turn off the debugging by commenting out the line $xajax->debugOn() in test.php.
you need <button type="button">, don't you? as-is, the buttons are submit buttons...
*** This bug has been marked as a duplicate of 97829 ***
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: