SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Member taluswood's Avatar
    Join Date
    Feb 2008
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Ajax on Apache/Windows xp

    I'm learning Ruby on Rails (Simply Rails 2) using my own windows xp running Apache. Everything is working fine except the Ajax code in Chapter 7.

    Do I need to install Java with Apache? And if so is there a link explaining how to do it?

    Any guidance would be greatly appreciated.

    Cheers, Bob

  2. #2
    SitePoint Evangelist
    Join Date
    Aug 2007
    Posts
    566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, java and javascript are 2 totally unrelated beast coming from different firms.
    Java has been created by sun, Javascript (livescript at the origin) is coming from Netscape.

    Beside, javascript is a client side scripting language, it runs exclusively on the browser side, not on the server side.
    It only interact with the server through requests.

  3. #3
    SitePoint Member taluswood's Avatar
    Join Date
    Feb 2008
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Tripy,
    Any idea why the Ajax is not working from my localhost server but works from a web server?

  4. #4
    SitePoint Evangelist
    Join Date
    Aug 2007
    Posts
    566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm, do you access it through the web server, or do you simply open the file through the network ?

  5. #5
    SitePoint Member taluswood's Avatar
    Join Date
    Feb 2008
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  6. #6
    SitePoint Evangelist
    Join Date
    Aug 2007
    Posts
    566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In that case, sorry, but I really don't see any obvious reasons.

  7. #7
    SitePoint Addict
    Join Date
    Feb 2007
    Posts
    270
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Debugging these things is always easy. First off, are you using Firefox? If so there's a nifty thing called "Firebug" you can install and it will show you the background communication between your browser and the server. You can see what is sent and what is received. That might get you closer to the problem.

    Aside from that, the only thing I can think of is for you to double-check the spelling of the service the javascript is connecting to. There has to be an action in the controller to receive the request and answer it, and the least spelling error will break that.

  8. #8
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,227
    Mentioned
    194 Post(s)
    Tagged
    2 Thread(s)
    I had some trouble for a while with this too. At first I thought the problem might be that Windows was associating the ".rjs" file with "RealSytem Skin", but I don't think it is. I fooled with it quite a bit, so I still don't know what it was (or what combination of things) that was the problem.

    Does your app/views/layouts/application.html.erb file have the line
    Code Ruby:
    <&#37;= javascript_include_tag :defaults %>

    If you look at the view-source of a page do you see something like
    HTML Code:
    <script src="/javascripts/prototype.js?1202241846" type="text/javascript"></script>
    <script src="/javascripts/effects.js?1202241846" type="text/javascript"></script>
    <script src="/javascripts/dragdrop.js?1202241846" type="text/javascript"></script>
    <script src="/javascripts/controls.js?1202241846" type="text/javascript"></script>
    <script src="/javascripts/application.js?1202241846" type="text/javascript"></script>
    What page are you up to?

  9. #9
    SitePoint Member taluswood's Avatar
    Join Date
    Feb 2008
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, the line is there and the view source is the same.

    The Score changes, but I'm not getting any effects.

  10. #10
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,227
    Mentioned
    194 Post(s)
    Tagged
    2 Thread(s)
    Does your shovell_7\app\views\votes\create.js.rjs file look like
    Code Ruby:
    page.replace_html 'vote_score', "Score: #{@story.votes.size}"
    page[:vote_score].visual_effect :highlight
    page[:vote_history].replace_html :partial => 'vote', :collection => @story.votes.latest

    What page are you up to?


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
  •