SitePoint Sponsor |
|
User Tag List
Results 1 to 10 of 10
Thread: Ajax on Apache/Windows xp
-
Oct 29, 2008, 06:31 #1
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
-
Oct 29, 2008, 07:46 #2
- 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.
-
Oct 29, 2008, 07:57 #3
Thanks Tripy,
Any idea why the Ajax is not working from my localhost server but works from a web server?
-
Oct 29, 2008, 08:11 #4
- 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 ?
-
Oct 29, 2008, 09:42 #5
I'm using http://localhost:3000/stories
-
Oct 29, 2008, 09:49 #6
- 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.
-
Oct 29, 2008, 13:05 #7
- 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.
-
Oct 29, 2008, 13:15 #8
- Join Date
- Jul 2005
- Location
- West Springfield, Massachusetts
- Posts
- 17,290
- Mentioned
- 198 Post(s)
- Tagged
- 3 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:<%= 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>
Big Change Coming Soon - if you want your PMs save them now!
What you need to do to prepare for our migration to Discourse
A New SitePoint Forum Experience: Our Move to Discourse
-
Oct 29, 2008, 13:29 #9
Yes, the line is there and the view source is the same.
The Score changes, but I'm not getting any effects.
-
Oct 29, 2008, 15:24 #10
- Join Date
- Jul 2005
- Location
- West Springfield, Massachusetts
- Posts
- 17,290
- Mentioned
- 198 Post(s)
- Tagged
- 3 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?Big Change Coming Soon - if you want your PMs save them now!
What you need to do to prepare for our migration to Discourse
A New SitePoint Forum Experience: Our Move to Discourse
Bookmarks