# JQuery Ajax clash

**URL:** <https://www.ruby-forum.com/t/jquery-ajax-clash/164247>\
**Category:** Rails\
**Created:** [March 30, 2009, 12:20pm UTC](https://www.ruby-forum.com/t/jquery-ajax-clash/164247 "2009-03-30T12:20:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![preethi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/f04885/32.png) [@preethi](https://www.ruby-forum.com/u/preethi)\
**Post date:** [March 30, 2009, 12:20pm UTC](https://www.ruby-forum.com/t/jquery-ajax-clash/164247/1 "2009-03-30T12:20:20Z")

</div>

Hi,

I’m having a search form which renders a table of search results.

The search box is doing an ajax call.

In my search results, i’ve JQuery scripts written for sorting and  
pagination and some other operations that i do with the table.

The issue is, I’m not able to have ajax and jquery calls in same page.

Is there any solution for this?

Your help is greatly appreciated. Thanks

---

<div class="post-metadata">

**Author:** ![preethi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/f04885/32.png) [@preethi](https://www.ruby-forum.com/u/preethi)\
**Post date:** [March 30, 2009, 12:46pm UTC](https://www.ruby-forum.com/t/jquery-ajax-clash/164247/2 "2009-03-30T12:46:40Z")

</div>

Preethi S. wrote:

> Hi,
> 
> I’m having a search form which renders a table of search results.
> 
> The search box is doing an ajax call.
> 
> In my search results, i’ve JQuery scripts written for sorting and  
> pagination and some other operations that i do with the table.
> 
> The issue is, I’m not able to have ajax and jquery calls in same page.
> 
> Is there any solution for this?
> 
> Your help is greatly appreciated. Thanks

jQuery.noConflict();  
jQuery(document).ready(function($){

});  
write this in javascript file from where you are callin function.

---

<div class="post-metadata">

**Author:** ![preethi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/f04885/32.png) [@preethi](https://www.ruby-forum.com/u/preethi)\
**Post date:** [March 30, 2009, 1:07pm UTC](https://www.ruby-forum.com/t/jquery-ajax-clash/164247/3 "2009-03-30T13:07:51Z")

</div>

Dharmdip R. wrote:

> jQuery.noConflict();  
> jQuery(document).ready(function($){
> 
> });  
> write this in javascript file from where you are callin function.

Thanks Raghod 🙂

I’ve added “jQuery.noConflice();” in my application.html.erb  
and  
the second chunk of code is added in my file where i’m calling the Java  
script.

Jquery is runnig perfectly. 🙂

The issue now is, Ajax calls are not working as I’m passing parameters  
in Ajax call using $ for fetching form’s variables.(i think it conflicts  
with Jquery’s $)

In my controller i’m getting the variable passed as “undefined”

How to over come this?

---

<div class="post-metadata">

**Author:** ![preethi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/f04885/32.png) [@preethi](https://www.ruby-forum.com/u/preethi)\
**Post date:** [March 30, 2009, 2:29pm UTC](https://www.ruby-forum.com/t/jquery-ajax-clash/164247/4 "2009-03-30T14:29:56Z")

</div>

Preethi S. wrote:

> Dharmdip R. wrote:
> 
> > jQuery.noConflict();  
> > jQuery(document).ready(function($){
> > 
> > });  
> > write this in javascript file from where you are callin function.
> 
> Thanks Raghod 🙂
> 
> I’ve added “jQuery.noConflice();” in my application.html.erb  
> and  
> the second chunk of code is added in my file where i’m calling the Java  
> script.
> 
> Jquery is runnig perfectly. 🙂
> 
> The issue now is, Ajax calls are not working as I’m passing parameters  
> in Ajax call using $ for fetching form’s variables.(i think it conflicts  
> with Jquery’s $)
> 
> In my controller i’m getting the variable passed as “undefined”
> 
> How to over come this?

Found the solution!  
I included Jquery first, jQuery.noConflict() next and then prototype.js  
in my application.html.erb  
It solved all the problems!! 🙂

---

<div class="post-metadata">

**Author:** ![preethi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/f04885/32.png) [@preethi](https://www.ruby-forum.com/u/preethi)\
**Post date:** [March 30, 2009, 2:33pm UTC](https://www.ruby-forum.com/t/jquery-ajax-clash/164247/5 "2009-03-30T14:33:54Z")

</div>

Good !
