Link to home
Start Free TrialLog in
Avatar of bruno_boccara
bruno_boccaraFlag for France

asked on

Jquery Conflict with prototype

Hello,

I have a problem with a conflict with my script between jquery and prototype.

At the beginning of my script, i use this library
<script src="/SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script>
<script src="/ScriptLibrary/jquery-latest.pack.js" type="text/javascript"></script>
<script src="/ScriptLibrary/jquery.autocomplete.js" type="text/javascript"></script>
<script src="/ScriptLibrary/jquery.bgiframe.min.js" type="text/javascript"></script>
<script src="/lib/prototype.js" type="text/javascript"></script>
<script src="/src/scriptaculous.js" type="text/javascript"></script>
<script src="/js/ajax.js" type="text/javascript"></script>
<script src='/js/jquery/jquery.2.js' ></script>

I use ajax too :

jQuery.ajax({
            url: '/test/test.php',
            type: 'POST',
            dataType: 'json',
            data: 'pRev=' + Rct,
            success: function(response)
});

After, i use parseJSON and i have a problem.

The error is : Object function (a,b){return new D.fn.init(a,b)} has no method 'parseJSON'

Here my code : jQuery.parseJSON(response)

Thanks for help.
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

At the top of your script you need to call the jQuery noConflict() function:

$.noConflict();
jQuery( document ).ready(function( $ ) {
// Code that uses jQuery's $ can follow here.
});

Open in new window

If you need jQuery outside of that then you must use jQuery in place of all $
Avatar of bruno_boccara

ASKER

I do this but its not work. i do jQuery.noConflict();

but why you do Jquery(document).ready(function($)
{
   
});

if i do just Jquery. for all its not good ?
ASKER CERTIFIED SOLUTION
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The problem was because we called twice the jquery library !

Thanks a lot