Jquery Conflict with prototype


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 :

            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.
Who is Participating?
Chris StanyonConnect With a Mentor Commented:
Calling the noConflict() hands back the $ to other libraries. The reason I put that code is that even with other libraries you can use the $ for jQuery inside that block.

If you're still getting problems, maybe post a link to your site so we can have a proper look. Impossible to tell from the snippet you've posted. You say you get an error with parseJSON, but your code doesn't show that call at all.

Also check the scripts you're loading - it looks like you might be loading 2 versions of jQuery - jquery-latest.pack.js and jquery.2.js
Chris StanyonCommented:
At the top of your script you need to call the jQuery noConflict() function:

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 $
bruno_boccaraAuthor Commented:
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 ?
bruno_boccaraAuthor Commented:
The problem was because we called twice the jquery library !

Thanks a lot
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.