Hi,

this works just fine:

<ui:define name="content">
<script>
var queue = TrPage.getInstance().getRequestQueue();

doAjax = function()
{

 queue.sendRequest(null, myCompletionMethod,
        "http://localhost:9090/json/users/51";);
}

myCompletionMethod  = function(evt)
{
  if(evt.getStatus()==TrXMLRequestEvent.STATUS_COMPLETE)
    alert('Ajax completed!');
}
</script>

<div onclick="doAjax();">JSON+Ajax</div>

</ui:define>

(in IE7 and FF2)

-M

On Fri, Mar 7, 2008 at 5:00 PM, Davide Bonicelli <[EMAIL PROTECTED]> wrote:
> Hi all,
>    any idea on this issue?
>
> Thanks for you help.
>
> Davide
>
>
>
> On Tue, Mar 4, 2008 at 11:14 AM, Davide Bonicelli <[EMAIL PROTECTED]> wrote:
>
> > Hi all,
> >    I'm trying to invoke the sendRequest() method from the Javascript
> Trinidad API.
> > Here is an example of the code I'm using for testing purpose:
> >
> > [code]
> > function doAjax(){
> >  var queue = TrPage.getInstance().getRequestQueue();
> >  queue.sendRequest(null, this.myCompletionMethod,
> >         "http://myhost/faces/ajaxReceive.xhtml?foo=bar";);
> > }
> >
> > function myCompletionMethod(evt)
> > {
> >        if(evt.getStatus()==TrXMLRequestEvent.STATUS_COMPLETE)
> >            alert('Ajax completed!');
> > }
> > [/code]
> >
> > If I invoke the script from Firefox (2.0.0.12) everything works fine and I
> can run it as many times as I want.
> > However, when I invoke the script from IE7 it is executed correctly only
> the first time and the subsequent ones the AJAX method is not invoked at
> all.
> > Am I doing something wrong or there's a problem with IE7 and the
> Javascript API?
> >
> > Another question: I need to use the sendRequest() method duringthe
> "window.onunload" event handling and everything works fine in Firefox (it
> simply doesn't run the code in the callback method), but IE7 behaves like
> before: the callback method is executed, but the script is executed only one
> time per browser session. This when I run the script in a very simple test
> scenario.
> > When instead I invoke sendRequest() during window.onunload in my
> application, I get the following javascript error:
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > TrXMLRequest is not defined
> > if(a96!=TrXMLRequest.COMPLETED)Common1_0_6.js (line 10484)
> >
> > TrXMLRequest is not defined
> > if(a96!=TrXMLRequest.COMPLETED)Common1_0_6.js (line 10484)
> >
> > TrXMLRequest is not defined
> > if(a96!=TrXMLRequest.COMPLETED)Common1_0_6.js (line 10484)
> > This doesn't affect Firefox at all, but do I'd like to remove this error:
> any idea on what's wrong?
> >
> > Thanks
> > Dado
> >
>
>



-- 
Matthias Wessendorf

further stuff:
blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
mail: matzew-at-apache-dot-org

Reply via email to