SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Dec 2004
    Location
    Syria
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    link_to_remote questions

    Hello,

    I tried link_to_remote to see the build-in AJAX capabilities with rails for the first time for me, I tried the following code and it worked:

    <%= link_to_remote( "some link",
    :update => "some_div",
    :url =>{ :action => :someaction }) %>

    OK, it has worked, but I have two questions here:

    1- When moving between links the URL in the browser still the same (which is the name of the controller), I expected that the name of the action must appear as it used to: www.domainname.com/controller/action

    2- How can I create some (Loading) div that appears while div is being updated (something similar to Gmail - the red div with Loading word at the top right of the page)

    Thanks

  2. #2
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1. Your URL won't change because the browser is not moving to a new location, the HTTP request is happening in the background.

    2. There are several ways of doing this. You can specify onLoading and onComplete callbacks on your AJAX links/forms but by far the easiest way is to have some kind of global loading bar. Check out this article:

    http://ajaxian.com/archives/ajax-act...ators-examples

  3. #3
    SitePoint Member
    Join Date
    Dec 2004
    Location
    Syria
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    Quote Originally Posted by Luke Redpath
    1. Your URL won't change because the browser is not moving to a new location, the HTTP request is happening in the background.
    Thanks Luke,
    Right the HTTP request is happening in the background, I think it's not a good idea to use link_to_remote for main website navigation, it's only good for updating some small div in the page not to be used as the main navigation method in the website. I did some search on this topic, it seems that there is no way to handle this someway ...

    Thanks for the Ajax indecators link, it was so useful for me


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •