You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Angelo Chen <an...@yahoo.com.hk> on 2008/03/09 15:58:15 UTC

t5: refreshing page inside a javascript

Hi,

I use a javascript(jQuery) to do an ajax call to an onActionFromXXX method
in the page class, I'd like to refresh the page after the call, any idea how
to do that inside a javascript? or just any other way to refresh page
programmatically? thanks.

A.C.
-- 
View this message in context: http://www.nabble.com/t5%3A-refreshing-page-inside-a-javascript-tp15934764p15934764.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: t5: refreshing page inside a javascript

Posted by Angelo Chen <an...@yahoo.com.hk>.
Hi,
Thanks for the fast response!  in my ajax call I updated some entities, I
can't obtain the streamresponse in the javascript, I need just refresh the
page. any idea?

A.C.


bobpuley wrote:
> 
> StreamResponse return type
> 
> M.
> 
> 2008/3/9, Angelo Chen <an...@yahoo.com.hk>:
>>
>>
>> Hi,
>>
>> I use a javascript(jQuery) to do an ajax call to an onActionFromXXX
>> method
>> in the page class, I'd like to refresh the page after the call, any idea
>> how
>> to do that inside a javascript? or just any other way to refresh page
>> programmatically? thanks.
>>
>> A.C.
>>
>> --
>> View this message in context:
>> http://www.nabble.com/t5%3A-refreshing-page-inside-a-javascript-tp15934764p15934764.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/t5%3A-refreshing-page-inside-a-javascript-tp15934764p15936828.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: t5: refreshing page inside a javascript

Posted by Angelo Chen <an...@yahoo.com.hk>.
Hi Josh,

This works and make code simpler, the only difference is, when u scroll to
the bottom of page and do a drag & drop, the browser will display the page
from the beg, so you have to scroll down again, not like the ajax call
first, then window.location.reload(), page remains in the same place after
refreshing.


joshcanfield wrote:
> 
> Hey Angelo,
> 
> I'm not a jQuery user, so I'm guessing that if updateProc is the
> actionLink, then are you passing source and dest as query parameters?
> You just need to append them to the actionLink url, right?
> 
> // this is off the top of my head, not tested, assumes no query params
> already on the actionLink etc.
> window.location = updateProc() + '?source=' +
> encodeURIComponent(sourceSeq) + '&dest=' +
> encodeURIComponent(destSeq);
> 
> Josh
> 
> 

-- 
View this message in context: http://www.nabble.com/t5%3A-refreshing-page-inside-a-javascript-tp15934764p15996534.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: t5: refreshing page inside a javascript

Posted by Josh Canfield <jo...@thedailytube.com>.
Hey Angelo,

I'm not a jQuery user, so I'm guessing that if updateProc is the
actionLink, then are you passing source and dest as query parameters?
You just need to append them to the actionLink url, right?

// this is off the top of my head, not tested, assumes no query params
already on the actionLink etc.
window.location = updateProc() + '?source=' +
encodeURIComponent(sourceSeq) + '&dest=' +
encodeURIComponent(destSeq);

Josh

On Mon, Mar 10, 2008 at 5:50 PM, Angelo Chen <an...@yahoo.com.hk> wrote:
>
> Hi Josh,
>
> would like to try this out, but how to pass parameters ? here is my code,
> updateProc is action link
>
> jQuery(".drop").droppable({
>            accept: ".block",
>            activeClass: 'droppable-active',
>            hoverClass: 'droppable-hover',
>            drop: function(ev, ui) {
>            var sourceSeq = jQuery(ui.element).attr("seq");
>
>            var destSeq = jQuery(this).children().attr("seq");
>            $("#dummy").load(updateProc(), {source: sourceSeq, dest:
> destSeq},function() {
>                refreshPage();
>            });
>        }
>    });
>
>
>
> joshcanfield wrote:
> >
> > Hi Angelo,
> >
> > If you aren't using a form, then it sounds like you have an actionlink
> > that you invoke from the drop handler using AJAX? Why not just point
> > window.location at the actionlink url instead and only do the request
> > to the server once?
> >
> > Josh
> >
> >
>
> --
> View this message in context: http://www.nabble.com/t5%3A-refreshing-page-inside-a-javascript-tp15934764p15972136.html
>
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: t5: refreshing page inside a javascript

Posted by Chris Lewis <ch...@bellsouth.net>.
You mean updateProc() calls the actionlink via AJAX? Apart from
usability, the problem of not using a form or any other 'natural' way
for the user to submit the data is that you leave no chance for T5 to
build the link for you. This means you'd have to construct it manually.
If it were a request that could respond to a restful style url with an
activation context, then it wouldn't be so bad. Otherwise you aren't
guaranteed that the structure of URLs won't change (one of T5's weak
points, imo). Therefore I'd suggest that you consider using a hidden
form whose (hidden) elements are updated by JS, and then ultimately
submitted by JS. Does that sound too hacked?

chris

Angelo Chen wrote:
> Hi Josh,
>
> would like to try this out, but how to pass parameters ? here is my code,
> updateProc is action link
>
> jQuery(".drop").droppable({
> 	    accept: ".block",
> 	    activeClass: 'droppable-active',
> 	    hoverClass: 'droppable-hover',
> 	    drop: function(ev, ui) {
>             var sourceSeq = jQuery(ui.element).attr("seq");
>
>             var destSeq = jQuery(this).children().attr("seq");
>             $("#dummy").load(updateProc(), {source: sourceSeq, dest:
> destSeq},function() {
>                 refreshPage();
>             });
>         }
>     });
>
>
>
> joshcanfield wrote:
>   
>> Hi Angelo,
>>
>> If you aren't using a form, then it sounds like you have an actionlink
>> that you invoke from the drop handler using AJAX? Why not just point
>> window.location at the actionlink url instead and only do the request
>> to the server once?
>>
>> Josh
>>
>>
>>     
>
>   

Re: t5: refreshing page inside a javascript

Posted by Angelo Chen <an...@yahoo.com.hk>.
Hi Josh,

would like to try this out, but how to pass parameters ? here is my code,
updateProc is action link

jQuery(".drop").droppable({
	    accept: ".block",
	    activeClass: 'droppable-active',
	    hoverClass: 'droppable-hover',
	    drop: function(ev, ui) {
            var sourceSeq = jQuery(ui.element).attr("seq");

            var destSeq = jQuery(this).children().attr("seq");
            $("#dummy").load(updateProc(), {source: sourceSeq, dest:
destSeq},function() {
                refreshPage();
            });
        }
    });



joshcanfield wrote:
> 
> Hi Angelo,
> 
> If you aren't using a form, then it sounds like you have an actionlink
> that you invoke from the drop handler using AJAX? Why not just point
> window.location at the actionlink url instead and only do the request
> to the server once?
> 
> Josh
> 
> 

-- 
View this message in context: http://www.nabble.com/t5%3A-refreshing-page-inside-a-javascript-tp15934764p15972136.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: t5: refreshing page inside a javascript

Posted by Josh Canfield <jo...@thedailytube.com>.
Hi Angelo,

If you aren't using a form, then it sounds like you have an actionlink
that you invoke from the drop handler using AJAX? Why not just point
window.location at the actionlink url instead and only do the request
to the server once?

Josh

On Mon, Mar 10, 2008 at 4:33 PM, Angelo Chen <an...@yahoo.com.hk> wrote:
>
> Hi Chris,
>
> It's part of drag and drop operation, when item was dropped, jQuery triggers
> a call, inside the call I updated the display order of items in the page,
> then refresh the page to reflect the changes made, there is no form.
>
>
>
> Chris Lewis-6 wrote:
> >
> > Forgive me if I'm missing something obvious here, but what's the point
> > in doing an ajax operation if you're going to refresh the entire page
> > when it returns? Why not just use a classic form?
> >
> > Angelo Chen wrote:
> >> window.location.reload(true) works, but reloading seems slow, is there
> >> any
> >> way to simulate a click in the javascript?
> >>
> >> <t:actionLink t:id="refresh">Refresh</t:actionLink>
> >>
> >> then in jQuery, I did:
> >> jQuery("#refresh").click();
> >> it does not trigger the actionLink.
> >>
> >> A.C.
> >>
> >>
> >> bobpuley wrote:
> >>
> >>> StreamResponse return type
> >>>
> >>> M.
> >>>
> >>> 2008/3/9, Angelo Chen <an...@yahoo.com.hk>:
> >>>
> >>>> Hi,
> >>>>
> >>>> I use a javascript(jQuery) to do an ajax call to an onActionFromXXX
> >>>> method
> >>>> in the page class, I'd like to refresh the page after the call, any
> >>>> idea
> >>>> how
> >>>> to do that inside a javascript? or just any other way to refresh page
> >>>> programmatically? thanks.
> >>>>
> >>>> A.C.
> >>>>
> >>>> --
> >>>> View this message in context:
> >>>> http://www.nabble.com/t5%3A-refreshing-page-inside-a-javascript-tp15934764p15934764.html
> >>>> Sent from the Tapestry - User mailing list archive at Nabble.com.
> >>>>
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >>>> For additional commands, e-mail: users-help@tapestry.apache.org
> >>>>
> >>>>
> >>>>
> >>>
> >>
> >>
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/t5%3A-refreshing-page-inside-a-javascript-tp15934764p15968052.html
>
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: t5: refreshing page inside a javascript

Posted by Angelo Chen <an...@yahoo.com.hk>.
Hi Chris,

It's part of drag and drop operation, when item was dropped, jQuery triggers
a call, inside the call I updated the display order of items in the page,
then refresh the page to reflect the changes made, there is no form. 


Chris Lewis-6 wrote:
> 
> Forgive me if I'm missing something obvious here, but what's the point
> in doing an ajax operation if you're going to refresh the entire page
> when it returns? Why not just use a classic form?
> 
> Angelo Chen wrote:
>> window.location.reload(true) works, but reloading seems slow, is there
>> any
>> way to simulate a click in the javascript?
>>
>> <t:actionLink t:id="refresh">Refresh</t:actionLink>
>>
>> then in jQuery, I did:
>> jQuery("#refresh").click();
>> it does not trigger the actionLink.
>>
>> A.C.
>>
>>
>> bobpuley wrote:
>>   
>>> StreamResponse return type
>>>
>>> M.
>>>
>>> 2008/3/9, Angelo Chen <an...@yahoo.com.hk>:
>>>     
>>>> Hi,
>>>>
>>>> I use a javascript(jQuery) to do an ajax call to an onActionFromXXX
>>>> method
>>>> in the page class, I'd like to refresh the page after the call, any
>>>> idea
>>>> how
>>>> to do that inside a javascript? or just any other way to refresh page
>>>> programmatically? thanks.
>>>>
>>>> A.C.
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/t5%3A-refreshing-page-inside-a-javascript-tp15934764p15934764.html
>>>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>>>       
>>>     
>>
>>   
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/t5%3A-refreshing-page-inside-a-javascript-tp15934764p15968052.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: t5: refreshing page inside a javascript

Posted by Chris Lewis <bu...@gmail.com>.
Forgive me if I'm missing something obvious here, but what's the point
in doing an ajax operation if you're going to refresh the entire page
when it returns? Why not just use a classic form?

Angelo Chen wrote:
> window.location.reload(true) works, but reloading seems slow, is there any
> way to simulate a click in the javascript?
>
> <t:actionLink t:id="refresh">Refresh</t:actionLink>
>
> then in jQuery, I did:
> jQuery("#refresh").click();
> it does not trigger the actionLink.
>
> A.C.
>
>
> bobpuley wrote:
>   
>> StreamResponse return type
>>
>> M.
>>
>> 2008/3/9, Angelo Chen <an...@yahoo.com.hk>:
>>     
>>> Hi,
>>>
>>> I use a javascript(jQuery) to do an ajax call to an onActionFromXXX
>>> method
>>> in the page class, I'd like to refresh the page after the call, any idea
>>> how
>>> to do that inside a javascript? or just any other way to refresh page
>>> programmatically? thanks.
>>>
>>> A.C.
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/t5%3A-refreshing-page-inside-a-javascript-tp15934764p15934764.html
>>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>>       
>>     
>
>   


Re: t5: refreshing page inside a javascript

Posted by Angelo Chen <an...@yahoo.com.hk>.
window.location.reload(true) works, but reloading seems slow, is there any
way to simulate a click in the javascript?

<t:actionLink t:id="refresh">Refresh</t:actionLink>

then in jQuery, I did:
jQuery("#refresh").click();
it does not trigger the actionLink.

A.C.


bobpuley wrote:
> 
> StreamResponse return type
> 
> M.
> 
> 2008/3/9, Angelo Chen <an...@yahoo.com.hk>:
>>
>>
>> Hi,
>>
>> I use a javascript(jQuery) to do an ajax call to an onActionFromXXX
>> method
>> in the page class, I'd like to refresh the page after the call, any idea
>> how
>> to do that inside a javascript? or just any other way to refresh page
>> programmatically? thanks.
>>
>> A.C.
>>
>> --
>> View this message in context:
>> http://www.nabble.com/t5%3A-refreshing-page-inside-a-javascript-tp15934764p15934764.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/t5%3A-refreshing-page-inside-a-javascript-tp15934764p15940737.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: t5: refreshing page inside a javascript

Posted by marco pugliese <pu...@gmail.com>.
StreamResponse return type

M.

2008/3/9, Angelo Chen <an...@yahoo.com.hk>:
>
>
> Hi,
>
> I use a javascript(jQuery) to do an ajax call to an onActionFromXXX method
> in the page class, I'd like to refresh the page after the call, any idea
> how
> to do that inside a javascript? or just any other way to refresh page
> programmatically? thanks.
>
> A.C.
>
> --
> View this message in context:
> http://www.nabble.com/t5%3A-refreshing-page-inside-a-javascript-tp15934764p15934764.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>