# Creating an Ajax.Updater - do I have to start the request?

**URL:** <https://www.ruby-forum.com/t/creating-an-ajax-updater-do-i-have-to-start-the-request/92955>\
**Category:** Rails\
**Created:** [April 26, 2007, 1:24am UTC](https://www.ruby-forum.com/t/creating-an-ajax-updater-do-i-have-to-start-the-request/92955 "2007-04-26T01:24:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pergesu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/22d042/32.png) [@pergesu](https://www.ruby-forum.com/u/pergesu)\
**Post date:** [April 26, 2007, 1:24am UTC](https://www.ruby-forum.com/t/creating-an-ajax-updater-do-i-have-to-start-the-request/92955/1 "2007-04-26T01:24:40Z")

</div>

I realize this is a Prototype question, but I figure somebody here  
knows the answer.

I want to make a simple HTTP request using Javascript and spit the  
results out onto my page. So I made an Ajax.Updater like this:

new Ajax.Updater(“view\_frame”, “[http://localhost:3000](http://localhost:3000)”,  
{asynchronous:false, evalScripts:true, method:‘get’});

I’ve got a div whose id is view\_frame, so I _think_ that this should  
make a request and then update view\_frame’s innerHTML to whatever the  
webserver renders. However looking at the logs no request is made at  
all. No Javascript errors. What do I need to do in order to make the  
request happen?

Pat

---

<div class="post-metadata">

**Author:** ![pergesu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/22d042/32.png) [@pergesu](https://www.ruby-forum.com/u/pergesu)\
**Post date:** [April 26, 2007, 1:51am UTC](https://www.ruby-forum.com/t/creating-an-ajax-updater-do-i-have-to-start-the-request/92955/2 "2007-04-26T01:51:42Z")

</div>

Your javascript looks fine except you need to provide the full path to  
the action you want executed.

[http://localhost:3000/controller/action](http://localhost:3000/controller/action)

If the action is an RJS template then you may not need to specify  
view\_frame as the target just use {} instead. If it is an rhtml  
template then all you need is to tell it what action to invoke. You  
do not need to start the action, it will make the request itself as  
part of the object creation with “new”.

Michael

---

<div class="post-metadata">

**Author:** ![pergesu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/22d042/32.png) [@pergesu](https://www.ruby-forum.com/u/pergesu)\
**Post date:** [April 26, 2007, 2:32am UTC](https://www.ruby-forum.com/t/creating-an-ajax-updater-do-i-have-to-start-the-request/92955/3 "2007-04-26T02:32:44Z")

</div>

On 4/25/07, MichaelLatta [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Your javascript looks fine except you need to provide the full path to  
> the action you want executed.

[http://localhost:3000/](http://localhost:3000/) is where I want the call to do. Basically I  
want the same behavior as an iframe…but I want to embed the HTML  
directly into the page rather than using an iframe. I thought that’s  
what this Updater is supposed to do - make an HTTP request and update  
some div with the results. Why is it not even making the request?

Pat

---

<div class="post-metadata">

**Author:** ![pergesu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/22d042/32.png) [@pergesu](https://www.ruby-forum.com/u/pergesu)\
**Post date:** [April 26, 2007, 3:48am UTC](https://www.ruby-forum.com/t/creating-an-ajax-updater-do-i-have-to-start-the-request/92955/4 "2007-04-26T03:48:48Z")

</div>

On 4/25/07, Pat M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On 4/25/07, MichaelLatta [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Your javascript looks fine except you need to provide the full path to  
> > the action you want executed.
> 
> [http://localhost:3000/](http://localhost:3000/) is where I want the call to do. Basically I  
> want the same behavior as an iframe…but I want to embed the HTML  
> directly into the page rather than using an iframe. I thought that’s  
> what this Updater is supposed to do - make an HTTP request and update  
> some div with the results. Why is it not even making the request?

I was reading the HTML file off my desktop, and using it to fetch a  
page from the Rails server. When I served up the HTML file from  
mongrel, it did it fine. It would have been nice if Updater had given  
an error instead of just not responding…

So is it possible at all to do what I want? I need the HTTP request  
go to a different domain than the web page being served up.

Pat
