allholy1 Posted April 26, 2007 Share Posted April 26, 2007 Hey guys, I'm setting up a page similar to google calendar's share calendar feature where you can add a list of users. When I add a person, it submits a POST request to an asp (classic 3.0) page which then sends the data over to a SQL 2005 database. Next, the JavaScript code sends a POST request to get the newly submitted data, generated in JSON. In Firefox, everything is perfect. But in IE, it always loads the previous data. Even if I enter a value using Firefox, then enter a new one in IE, it still loads the old value, even 10 seconds after the previous submission. Once I submit again, it then loads the proper values. I'm using the prototype.js library to perform all the AJAX requests. I've spent so long trying to fix this . When one types in the name and e-mail and hit the add button, it calls this script: function addPerson(theForm) { theForm1=document.getElementById(theForm); person = theForm1.newAccessPerson.value; person = trim(person); address = trim(theForm1.newAccessPersonEmail.value); if (person == null || person == '' || address == null || address == '') return; else { new Ajax.Request('signup.asp?group=65535&id=1&option=addnewperson', { parameters: $(theForm).serialize(true) }); getNewPerson('json'); } } Next it adds to the database but I don't think I need to post that, so after that I send a request to get the new data with this function: function getNewPerson(opt) { new Ajax.Request('signup.asp?group=65535&id=1&option=' + opt, { method:'post', onSuccess: function(transport){ var response = null; response = transport.responseText || "no response text"; drawNewPerson(response); }, onFailure: function(){ return('Something went wrong...') } }); } Here's how the ASP page where the request is generated: sub json() response.Expires=-1 pStr = "private, no-cache, must-revalidate" Response.ExpiresAbsolute = #2000-01-01# Response.AddHeader "pragma", "no-cache" Response.AddHeader "cache-control", pStr Response.Write("{""id"":""" & rs_RecordSet("ID") & """,""name"":"""& rs_RecordSet("Name") & """,""email"":""" & rs_RecordSet("EmailAddress") & """}") end sub And finally, add the person to the table: var person = null person = html.evalJSON(); var x=document.getElementById('svalues').insertRow(0); var namecell=x.insertCell(0); var emailcell=x.insertCell(1); var deletecell=x.insertCell(2); namecell.innerHTML=person.name; emailcell.innerHTML=person.email; deletecell.innerHTML='<a href=\"javascript:deletePerson(\'' + person.id + '\')\"><img width=\"9\" height=\"10\" src=\"images/icon_delete.gif\" style=\"width: 9px; height: 10px;\"/></a>'; } This happens in both versions 6 and 7. Thanks in advance Quote Link to comment Share on other sites More sharing options...
xenophobia Posted April 27, 2007 Share Posted April 27, 2007 Add one more request in your url request address. Your url: var randnumber = Math.random(10); var url = "*.asp?....&randomnumber=" + randnumber; This will avoid the browser being cache. Quote Link to comment Share on other sites More sharing options...
allholy1 Posted April 27, 2007 Author Share Posted April 27, 2007 Thanks, but are you sure that its something like that? If I post something using Firefox, then post something using IE, the Firefox result displays next. So IE never really caches that new value. Quote Link to comment Share on other sites More sharing options...
allholy1 Posted May 1, 2007 Author Share Posted May 1, 2007 I tried it out today and the same exact thing is happening . Could prototype not be compatible with IE completely? var randnumber = Math.random(10); var url = "/signup.asp?option=" + opt + "&randomnumber=" + randnumber; new Ajax.Request(url, { method:'post', onSuccess: function(transport){ var response = null; response = transport.responseText || "no response text"; drawNewPerson(response); }, onFailure: function(){ return('Something went wrong...') } }); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.