When a user interacts with my login form by entering their username and password, they can click on the login button to send a request to a server.
The login button triggers a function called submitLoginFormIntoDivAndReload, which in turn calls another function named submitFormObjIntoDivAndReload.
Here is an overview of these functions:
function submitLoginFormIntoDivAndReload(servletUrl, formObj, divId) {
var shortUserName = formObj.shortusername.value;
alert("Starting userName: " + shortUserName);
var organization = formObj.organization.value;
alert("Organization: " + organization);
formObj.username.value = createLdapString(shortUserName, organization);
alert("Ending userName: " + formObj.username.value);
var loggingInContent = "<table><tr><td width='600px' align='center'><p>logging in</p></td></tr></table>"
document.getElementById(divId).innerHTML = loggingInContent;
submitFormObjIntoDivAndReload(servletUrl, formObj, divId);
}
function submitFormObjIntoDivAndReload(url, formObj, divId) {
alert('Form object: ' + formObj);
alert('URL: ' + url);
alert('divId: '+divId);
var myRequest = new Ajax.Updater(divId, url,
{ method: 'post',
parameters: Form.serialize(formObj),
onSuccess: function(response) {
window.location.reload();
}
});
alert("After update");
}
This code works flawlessly on Firefox, but encounters issues on Internet Explorer.
In IE, all alerts are displayed for debugging purposes, however, it appears that Ajax.Updater fails to send a request to the server (no output visible on the server side).
On FireFox, all alerts are also shown and Ajax.Updater successfully sends a request to the server, producing the expected output on the server side.
Research suggests that IE may have a cache issue: Ajax updater not working in internet explorer However, this seems to affect only the "GET" method, not the "POST" method which I am using. I even tried adding a fake input to the form, but it still didn't work.
If anyone has any insights or ideas, I would greatly appreciate it!
By the way, I am utilizing prototype 1.5.1.