Women in Technology

Hear us Roar



Article:
  Ajax on Rails
Subject:   can ajax be used for updating two or more div's simultaniously
Date:   2005-09-12 12:12:58
From:   viper_again
hello there...

i am a bignner to this ruby on rails and ajax.... i really liked the way this ajax thing works....


but i want this ajax to update 2 divs simultaniously in a page... can this be possible... can anyone plz help me out with this...


thanks for ur concern.
viper.

Full Threads Oldest First

Showing messages 1 through 5 of 5.

  • can ajax be used for updating two or more div's simultaniously
    2006-09-14 09:22:52  EpsilonsDad [View]

    After playing with this I have found that you can take advantage of the fact that the rails ajax framework evaluates javascript within the response. So the response hander to fill two divs could be something like this.

    def response_handler
    #content for div1
    @text = "New text in div1"
    #content for div2
    @text += "<script language=\"javascript\" >document.all.div2.innerHTML='New text in div2';</script>"
    render :text => @text
    end

    Which should update mutilple blocks
  • Curt Hibbs photo can ajax be used for updating two or more div's simultaniously
    2005-09-12 12:26:50  Curt Hibbs | O'Reilly AuthorO'Reilly Blogger [View]

    Yes you can, but not having done that yet myself, I can't be any more specific. I just know there is a way to have your own JavaScript function be called when data is returned from the server. And, of course, your JavaScript can update as many parts of the document as you need.

    I would subscribe to the Rails developer mailing list and ask your question there:

    http://lists.rubyonrails.org/mailman/listinfo/rails
    • can ajax be used for updating two or more div's simultaniously
      2005-09-12 22:09:57  viper_again [View]

      thank u curth for ur concern...

      .. ill be happy if u can guide me how to go about doing this ... as i told already.. i am just a beginer to ruby on rails
      • Curt Hibbs photo can ajax be used for updating two or more div's simultaniously
        2005-09-13 04:01:28  Curt Hibbs | O'Reilly AuthorO'Reilly Blogger [View]

        Sorry, I don't personal know the answer. Please take my suggestion and subscribe to the Rails mailing list. You will find plenty of people there who can give you an answer.
        • can ajax be used for updating two or more div's simultaniously
          2005-09-14 08:20:34  viper_again [View]

          ok thank u curth...

          i will let u know.. if i end up with a solution.