[Proto-Scripty] Re: how to update a function with a remote call

2010-09-24 Thread nephish
Hey there,

Wanted to say thanks for all your help here.
The links especially.
I am still very new at all this and it's a lot to get my head around.
That site is excellent.

sk

On Sep 22, 4:53 pm, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi,

 You're taking the return value of `new Ajax.Request` and using it to
 set the contents of `weather_table_one`. The return value of `new
 Ajax.Request` is (of course) an Ajax.Request object. It's really worth
 reading the documentation.

 If you want to use the contents of the resource that the Ajax.Request
 loads, you need to use the onSuccess callback:

 function replace_weather_table(){
     zoomy = map.getZoom();
     new Ajax.Request('/weather/update_weather_tables?zoom='+zoomy,
         onSuccess: function(response) {
             weather_table_one.setContents(response.responseText);
         }
     });

 };

 Note that by default, Ajax requests are asynchronous, and so the
 update will happen at some point after the `replace_weather_table`
 function returns. You probably want to handle failures as well.

 More 
 here:http://api.prototypejs.org/ajax/ajax/request/http://proto-scripty.wikidot.com/prototype:how-to-bulletproof-ajax-re...

 HTH,
 --
 T.J. Crowder
 Independent Software Engineer
 tj / crowder software / com
 www / crowder software / com

 On Sep 22, 7:22 pm, nephish neph...@gmail.com wrote:



  I am working with a javascript function called Elabel, part of the
  Google maps api
  the Elabel has a function called setContents(html)

  i need to be able to call this function and get new html for it. ( the
  html is a table that displays weather data)

  here is what i have so far

  function replace_weather_table(){
          zoomy = map.getZoom();
          weather_table_one.setContents(new Ajax.Request('/weather/
  update_weather_tables?zoom='+zoomy));

  };

  GEvent.addListener(map,moveend, replace_weather_table);

  i would like to have the contents be those of a partial, but when
  executed, the display only shows [object Object]

  would appreciate any help, thanks

  sk

-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



[Proto-Scripty] Re: how to update a function with a remote call

2010-09-24 Thread T.J. Crowder
Hi,

Sorry, I missed out an opening bracket. Should have been:

function replace_weather_table(){
zoomy = map.getZoom();
new Ajax.Request('/weather/update_weather_tables?zoom='+zoomy, {
// ^--
this was missing
onSuccess: function(response) {
weather_table_one.setContents(response.responseText);
}
});
};

-- T.J.

On Sep 23, 8:29 pm, nephish neph...@gmail.com wrote:
 Thanks for your help,

 i am getting a syntax error in firebug when i place this in my script.

 missing ) after argument list  in this line
 onSuccess: function(response) {

 i have tried lots of different adjustments.

 thanks
 sk

 On Sep 22, 4:53 pm, T.J. Crowder t...@crowdersoftware.com wrote:



  Hi,

  You're taking the return value of `new Ajax.Request` and using it to
  set the contents of `weather_table_one`. The return value of `new
  Ajax.Request` is (of course) an Ajax.Request object. It's really worth
  reading the documentation.

  If you want to use the contents of the resource that the Ajax.Request
  loads, you need to use the onSuccess callback:

  function replace_weather_table(){
      zoomy = map.getZoom();
      new Ajax.Request('/weather/update_weather_tables?zoom='+zoomy,
          onSuccess: function(response) {
              weather_table_one.setContents(response.responseText);
          }
      });

  };

  Note that by default, Ajax requests are asynchronous, and so the
  update will happen at some point after the `replace_weather_table`
  function returns. You probably want to handle failures as well.

  More 
  here:http://api.prototypejs.org/ajax/ajax/request/http://proto-scripty.wik..

  HTH,
  --
  T.J. Crowder
  Independent Software Engineer
  tj / crowder software / com
  www / crowder software / com

  On Sep 22, 7:22 pm, nephish neph...@gmail.com wrote:

   I am working with a javascript function called Elabel, part of the
   Google maps api
   the Elabel has a function called setContents(html)

   i need to be able to call this function and get new html for it. ( the
   html is a table that displays weather data)

   here is what i have so far

   function replace_weather_table(){
           zoomy = map.getZoom();
           weather_table_one.setContents(new Ajax.Request('/weather/
   update_weather_tables?zoom='+zoomy));

   };

   GEvent.addListener(map,moveend, replace_weather_table);

   i would like to have the contents be those of a partial, but when
   executed, the display only shows [object Object]

   would appreciate any help, thanks

   sk

-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



[Proto-Scripty] Re: how to update a function with a remote call

2010-09-23 Thread nephish
Thanks for your help,

i am getting a syntax error in firebug when i place this in my script.


missing ) after argument list  in this line
onSuccess: function(response) {

i have tried lots of different adjustments.

thanks
sk

On Sep 22, 4:53 pm, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi,

 You're taking the return value of `new Ajax.Request` and using it to
 set the contents of `weather_table_one`. The return value of `new
 Ajax.Request` is (of course) an Ajax.Request object. It's really worth
 reading the documentation.

 If you want to use the contents of the resource that the Ajax.Request
 loads, you need to use the onSuccess callback:

 function replace_weather_table(){
     zoomy = map.getZoom();
     new Ajax.Request('/weather/update_weather_tables?zoom='+zoomy,
         onSuccess: function(response) {
             weather_table_one.setContents(response.responseText);
         }
     });

 };

 Note that by default, Ajax requests are asynchronous, and so the
 update will happen at some point after the `replace_weather_table`
 function returns. You probably want to handle failures as well.

 More 
 here:http://api.prototypejs.org/ajax/ajax/request/http://proto-scripty.wikidot.com/prototype:how-to-bulletproof-ajax-re...

 HTH,
 --
 T.J. Crowder
 Independent Software Engineer
 tj / crowder software / com
 www / crowder software / com

 On Sep 22, 7:22 pm, nephish neph...@gmail.com wrote:



  I am working with a javascript function called Elabel, part of the
  Google maps api
  the Elabel has a function called setContents(html)

  i need to be able to call this function and get new html for it. ( the
  html is a table that displays weather data)

  here is what i have so far

  function replace_weather_table(){
          zoomy = map.getZoom();
          weather_table_one.setContents(new Ajax.Request('/weather/
  update_weather_tables?zoom='+zoomy));

  };

  GEvent.addListener(map,moveend, replace_weather_table);

  i would like to have the contents be those of a partial, but when
  executed, the display only shows [object Object]

  would appreciate any help, thanks

  sk

-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



[Proto-Scripty] Re: how to update a function with a remote call

2010-09-22 Thread T.J. Crowder
Hi,

You're taking the return value of `new Ajax.Request` and using it to
set the contents of `weather_table_one`. The return value of `new
Ajax.Request` is (of course) an Ajax.Request object. It's really worth
reading the documentation.

If you want to use the contents of the resource that the Ajax.Request
loads, you need to use the onSuccess callback:

function replace_weather_table(){
zoomy = map.getZoom();
new Ajax.Request('/weather/update_weather_tables?zoom='+zoomy,
onSuccess: function(response) {
weather_table_one.setContents(response.responseText);
}
});
};

Note that by default, Ajax requests are asynchronous, and so the
update will happen at some point after the `replace_weather_table`
function returns. You probably want to handle failures as well.

More here:
http://api.prototypejs.org/ajax/ajax/request/
http://proto-scripty.wikidot.com/prototype:how-to-bulletproof-ajax-requests

HTH,
--
T.J. Crowder
Independent Software Engineer
tj / crowder software / com
www / crowder software / com

On Sep 22, 7:22 pm, nephish neph...@gmail.com wrote:
 I am working with a javascript function called Elabel, part of the
 Google maps api
 the Elabel has a function called setContents(html)

 i need to be able to call this function and get new html for it. ( the
 html is a table that displays weather data)

 here is what i have so far

 function replace_weather_table(){
         zoomy = map.getZoom();
         weather_table_one.setContents(new Ajax.Request('/weather/
 update_weather_tables?zoom='+zoomy));

 };

 GEvent.addListener(map,moveend, replace_weather_table);

 i would like to have the contents be those of a partial, but when
 executed, the display only shows [object Object]

 would appreciate any help, thanks

 sk

-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.