You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Anthony Fox <an...@gmail.com> on 2005/05/25 16:31:34 UTC
Tapestry/AJAX question
Hi,
I am new to Tapestry so forgive me if the answer to this question is simple.
I am trying to create a navigation system using AJAX and Tapestry.
All the navigation links call a javascript function that uses an
XMLHttpRequest to request a page from Tapestry and updates the
innerHTML of a div element with the response. The html source is
included below. This works fine until the page I request from
Tapestry needs to hook into the Body component to insert some
javascript. For instance, I use the contrib:Palette component in one
page and it squawks when rendering due to the fact that it is not
wrapped by a Body component. Is there any way around this or do I
have to forgoe using components that need to be wrapped by the Body
component?
Thanks,
Anthony
<html>
<script>
function navigateLink(arg) {
var div = document.getElementById("content");
var request = new XMLHttpRequest;
request.open("GET", "/myApp/app?service=page/" + arg, true);
request.onreadystatechange = function() {
if(request.readyState == 4) {
div.innerHTML = request.responseText;
}
}
request.send(null);
}
</script>
<body>
<table>
<tr><td>Nav Bar</td></tr>
<tr><td><a href="#" onclick="navigateLink('Link1')">Link One</a></td></tr>
<tr><td><div id="content"/</tr></td>
</table>
</body>
</html>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Tapestry/AJAX question
Posted by Jamie Orchard-Hays <ja...@dang.com>.
Anthony, you should check out the AJAX stuff at t-deli and tacos to get
an idea of how to approach this.
Jamie
On May 25, 2005, at 10:31 AM, Anthony Fox wrote:
> Hi,
>
> I am new to Tapestry so forgive me if the answer to this question is
> simple.
>
> I am trying to create a navigation system using AJAX and Tapestry.
> All the navigation links call a javascript function that uses an
> XMLHttpRequest to request a page from Tapestry and updates the
> innerHTML of a div element with the response. The html source is
> included below. This works fine until the page I request from
> Tapestry needs to hook into the Body component to insert some
> javascript. For instance, I use the contrib:Palette component in one
> page and it squawks when rendering due to the fact that it is not
> wrapped by a Body component. Is there any way around this or do I
> have to forgoe using components that need to be wrapped by the Body
> component?
>
> Thanks,
> Anthony
>
> <html>
> <script>
> function navigateLink(arg) {
> var div = document.getElementById("content");
> var request = new XMLHttpRequest;
> request.open("GET", "/myApp/app?service=page/" + arg, true);
> request.onreadystatechange = function() {
> if(request.readyState == 4) {
> div.innerHTML = request.responseText;
> }
> }
> request.send(null);
> }
> </script>
> <body>
> <table>
> <tr><td>Nav Bar</td></tr>
> <tr><td><a href="#" onclick="navigateLink('Link1')">Link
> One</a></td></tr>
> <tr><td><div id="content"/</tr></td>
> </table>
> </body>
> </html>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org