In your Ajax.Request call when you specify the onSuccess, you are
actually calling the function. To pass a function as a parameter and
also determine what parameters it will be called with you should use
bind or a closure. In this case a closure seems more appropriate.
new Ajax.Request('products.clearCustomValues.php', {
onSuccess: function(){ updateMoreInfo(art_num, row_id); },
method: 'post',
postBody: postvars
});
Colin
SubZane wrote:
> I've got a DIV which content I retreive using Ajax.Updater, the content
> also has a button that calls a Ajax.Request, and on my onComplete I
> wish to reload the DIV.
> Problem is tho that the DIV is not updated, it's still the same data it
> was before I pressed the button, in fact I need to press the button
> twice to get an update as if the Updater retreives cached data.
>
> I'm using POST method on both requests, I try passing along a random
> number, but still I have to press the button twice in order to get a
> fresh reload of the DIV content.
>
> The problem occurs in Firefox (Haven't tested any other browser)
>
> My functions
> ------------------
>
> function updateMoreInfo(art_num, id) {
> var rand = new Date().getTime();
> var pars = 'art_num='+art_num+'&row_id='+id+'&rand='+rand;
> new Ajax.Updater(id, 'product.search.tablemore.php', {onComplete:
> searchComplete, method: 'post', evalScripts:true, postBody: pars});
> }
>
> function searchComplete() {
> new Effect.Appear('search-results', { duration: 0 });
> }
>
> function restore(art_num, row_id, field) {
> var postvars = 'field='+field+'&art_num='+art_num
> new Ajax.Request('products.clearCustomValues.php', {onSuccess:
> updateMoreInfo(art_num, row_id), method:'post', postBody:postvars});
> }
>
>
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs
-~----------~----~----~----~------~----~------~--~---