You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Loïc Talbot <lo...@gmail.com> on 2007/10/18 22:39:59 UTC

[T4] - Tapestry.bind basic Ajax example

Hi there,

I 'd like to implement a "DirectLink-like" function using tapestry.bind &
load functions in order to use the result in other Javascript functions.

Here is my simple example:

        <script type="text/javascript">
        var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
        var content;
        function SendAjaxRequest() {
            tapestry.bind
("/PhoneBook/app?component=%24DirectLink&amp;page=majax&amp;service=direct");
            tapestry.load(xmlDoc);
            content = xmlDoc.responseXML;
        }
        </script>
        <p>
            <a href="#" onclick="SendAjaxRequest()">click here</a>
        </p>

----
The server-side Java component does work with @DirectLink. In the above
lines it seems no connection to the server is done when clicking plus there
is a strange Firebug error message :"Component returned failure code:
0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIXMLHttpRequest.setRequestHeader]"
nsresult: "0x80070057..............."  it does not appear in IE7.

Of course I should use DirectLink you may say but I think I cannot because I
want to reuse the result of the Ajax request into another Javascript
function before.

Any hint/link/remark appreciated !
Thanks!
Loïc