Ajax OpenRico Example
by Mike Levin SEO & Datamaster, 07/11/2005
I’m following the OpenRico PDF documentation. I wanted to get the example down to the bare minimum. The page making the call is static HTML. The page serving the XML response is asp. We ran into two interesting issues. The first involved optional parameters being required, and the second involved caching.
In trying to make the minimal program, no parameter needed to be fed on the ajaxEngine.sendRequest. We simply made an asp page that returned hard-wired XML. No problem, right? Or so we thought. After losing the whole morning trying to get it to work, (no errors being reported, but no XML being returned) we feed an arbitrary parameter to ajaxEngine.sendRequest. It worked. So, in the below example, the arbitrary parameter is required!
And now for the caching issue. Here is the asp file we ended up going with to produce the XML…
<% Response.ContentType=”text/xml” Response.CacheControl = “no-cache” Response.AddHeader “pragma”,”no-cache” myDate = Now() %> <ajax-response> <response type=“element” id=“tgtEle”> <span><%=myDate%></span> </response> </ajax-response>
In order for FireFox to work correctly, this line was not required… Response.CacheControl = “no-cache”
…but on MSIE, it absolutely is required. You can hit the time button over and over, and the seconds will never increment. This is tied to the session. If you close the browser window and open a new one, you will get a new time. But subsequent button presses will not change the time. I suspect interaction between MSIE and IIS, because the Response.CacheControl does not change the response. It is a server instruction.
For good measure, I am also including this line…
We have not seen it have any effect, but because it adds data to the header, any proxy servers in between should honor the request to not cache the data.
And I discovered a nice code beautifier at manoli.net.