Sebastian, thanks for your response and idea.

Taking your idea  myproject.zip
<http://apache-wicket.1842946.n4.nabble.com/file/n4667990/myproject.zip>  I
am trying to use the following javascript code in wicket: 



Http.Get = function(theUrl)
{
    var xmlHttp = null;
        try
        {
                xmlHttp = new XMLHttpRequest();
                return xmlHttp.open("GET", theUrl, true );
                xmlHttp.send();
                return xmlHttp.statusText;
                //return xmlHttp.responseText;
        }
        catch (error)
        {
                return 'error in my code: ' + error;
        }
}


The above code is called via:

                add(new AjaxLink("link")
                {


                        @Override
                        public void onClick(AjaxRequestTarget target) 
                        {
                                target.add(testLabel);                          
                        }
                        
                        
                        @Override
                        protected IAjaxCallDecorator getAjaxCallDecorator()
                        {
                                return new IAjaxCallDecorator()
                                {
                                        private static final long 
serialVersionUID = 1L;

                                        public CharSequence decorateScript(
                                                Component component,
                                                CharSequence script) 
                                        {
                                                return 
"document.getElementById('testlabel').innerHTML = 'plain '  +
Http.Get('http://www.cnn.com') ;" + script;
                                        }

                                        
                                        public CharSequence 
decorateOnSuccessScript(
                                                Component component, 
                                                CharSequence script) 
                                        {
                                                return 
"document.getElementById('testlabel').innerHTML = 'on success '
+ Http.Get('http://www.cnn.com') ;" + script;
                                        }

                                        
                                        public CharSequence 
decorateOnFailureScript(
                                                Component component, 
                                                CharSequence script) 
                                        {
                                                return 
"document.getElementById('testlabel').innerHTML = 'on Failure '
+  Http.Get('http://www.cnn.com') ;" + script;
                                        }
                                };
                        }
                        
                });


The problem is that when I use it in wicket the xmlHttp.statusText or
xmlHttp.responseText returns nothing.  
Can any one please tell me what I might be doing wrong? 
Does the code or calling it even makes sense?

I am attaching  quickstart project.  Please see:
com.mytest.javascript.*


Thanks.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Handling-page-refresh-or-redirect-when-the-server-reboots-tp4667465p4667990.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to