views:

197

answers:

2

Hi All,

I'm new to JQuery and so far I'm using prototype. But now I want to use JQuery and the thing is I done want to change my old code, which uses prototype

I installed jrails plugin also

my question is can i use

new Ajax.Updater etc.. kind of methods with JQuery (having the jrails plugin installed)

(it doesnt work for me)

BTW - I'm getting JQuery from here http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js

thanks in advance

cheers sameera

+1  A: 

I'm not sure if I understand your question completely but it seems to me that you are asking if you can use both Prototype and jQuery because you don't want to have to change all your old code. The best thing to do would be to put jQuery in noConflict mode. Under your inclusion of the jquery file from google, just do this:

<script>
  var $j = jQuery.noConflict();
</script>

That way jQuery won't step on Prototype's toes. instead of calling jQuery with a $ you'd use $j for example:

$j('#sidebar').hide();

I hope that helps... if indeed that's what you were asking.

Tim K.
Hi Tim Thanks for the replay. Actually I dont want to use Prototype at all, But I want to use the same syntax with Jquery like new Ajax.Updater etc.. (which comes with phototype)So, can i use them as it is (having installed jrails) or is there any other way to do thatthanks againcheerssameera
sameera207
Okay - I see what you mean... Ajax.Updater is prototype's way of doing an Ajax load. With jQuery you would use the load method... $('#element').load(url and parameters here);
Tim K.
Hi Timthanks for your effort, but still the problem remainsI'm using it as this<div id="income_report"></div><script type="text/javascript"> $('#income_report').load('/sites/index');</script>where as '/sites/index' is my sites controller and index action, am I doing something wrong herethankssameera
sameera207
You might consider using Firebug to make sure the request is actually getting sent out.
Tim K.
A: 

I found that jrails was acting strange for me a few weeks ago. I discovered that the gem version solved my problems. Try installing it as a gem (if you're currently running it as a plugin) and see what happens.

rsturim
Hi rsturimthanks, I removed the plugin and installed it as a gem (jrails-0.6.0) but still the problem exist..I'm getting jquery from googlehttp://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.jswill that be a problem thanks sameera
sameera207