AJAX is a great tool for building some really slick applications, but it has one limitation has made me ignore it for a number of things that I have wanted to do. After speaking with Chris Toohey and stealing getting inspiration from some code that he had, I have come up with a simple agent to allow me to get data from other domains. The agent is incredibly simple, but I have no idea what kind of impact this will have on the server, so test thoroughly before you implement it in your environment.
First, create an new LS agent and set the run-time security level to 2. Allow Restricted Operations. The agent can be as complex as you want it to be, but below is all that is necessary:
Dim s As New NotesSession Dim doc as NotesDocument Dim xml As Variant Dim temp As String Set doc = session.DocumentContext temp = StrRight(doc.Query_String_Decoded(0),"url=") Set xml = CreateObject("Microsoft.XMLHTTP") xml.Open "GET", temp , False xml.Send Print "Content-Type:text/html" Print "Cache-Control:NoCache" Print Cstr(xml.ResponseText) Set xml = nothing
Finally, you create an AJAX call on your page that calls the agent you created and pass the URL you want to retrieve as a query string parameter. That's all it takes to basically have one AJAX call access another AJAX call to get data from some other domain. Just to prove that my dogfood tastes good, I am using a version of this agent to retrieve my Bloglines Blog Roll on the right. Just click on the RSS icon to see the data retrieved via AJAX.
Created 3/29/2006 2:35:00 AM email | website
Yahoo's xmlhttprequest proxy solution is similar:
{ Link }
I think theirs handles POST requests too - the example above appears restricted to GET requests.
Created 3/29/2006 11:12:50 AM email | website
Sounds very similar. In this case we are using the Domino server as a proxy and allowing the LotusScript or Java agents to parse the data returned.
This solution simply uses GET becuase I just decided to code it that way, but it would be able to handle a POST request also if necessary. In fact, if you used it with a Domino 7 Web Service, you would be required to use a POST command, because a GET command would return the name of the service and its operations.
Sean---
Created 3/13/2007 6:19:36 PM email | website
I use your example in this link
{ Link }
but i get this error in log.nsf
HTTP Server: Agent 'Ajax2' error: OLE: Automation object error
I install the dll this ajax need in the server machine i use the javascript code in a form and works fine, but when execute this agent only recibe Agent Done and the error in the log.nsf DB, any sugestions ?
Thanks in advance
Gerardo