Forum: Ruby on Rails JQuery Ajax clash

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Cc6ae9862e93740637dbbea00b680616?d=identicon&s=25 Preethi Sivakumar (preethi)
on 2009-03-30 12:20
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
Af10464d988bde1b15b1a324237bad84?d=identicon&s=25 Dharmdip Rathod (dharmdip)
on 2009-03-30 12:46
Preethi Sivakumar 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.
Cc6ae9862e93740637dbbea00b680616?d=identicon&s=25 Preethi Sivakumar (preethi)
on 2009-03-30 13:07
Dharmdip Rathod 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?
Cc6ae9862e93740637dbbea00b680616?d=identicon&s=25 Preethi Sivakumar (preethi)
on 2009-03-30 14:29
Preethi Sivakumar wrote:
> Dharmdip Rathod 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!! :)
Af10464d988bde1b15b1a324237bad84?d=identicon&s=25 Dharmdip Rathod (dharmdip)
on 2009-03-30 14:33
Good !
This topic is locked and can not be replied to.