0

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

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

4 Comments

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 that thanks again cheers sameera
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);
Hi Tim thanks for your effort, but still the problem remains I'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 here thanks sameera
You might consider using Firebug to make sure the request is actually getting sent out.
0

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.

1 Comment

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.