0

I am using a lot of jQuery libraries in my application.

My application is based on a map, and the map is generated by my own server mapmyindia.com.

The problem is that there is a jQuery conflict that occurs when I use fancybox jQuery library, pagination jQuery library and drop-down checklist jQuery library, all work together.

My direction search API's don't work because of a jQuery library conflict.

However, if I remove all the jQuery libraries, I can use my direction search API just fine.

With the jQuery libraries enabled, it gives me an error:

$.jsonp is not a function

My application is on app.mapmyindia.com/michelin please help me.......

<script>MIREO_RESOURCES_ROOT = "http://46.137.254.191/MapServer/";</script>
<script type="text/javascript" src="http://46.137.254.191/MapServer/MireoWebMap.js"></script>

<script type="text/javascript">
    var map = $("#map");
    var valid = new Validation();
    map.MireoMap();
</script>


<script type="text/javascript" src="jquery/jquery-1.6.1.min.js"></script>
<script type="text/javascript" src="jquery/jquery-ui-1.8.13.custom.min.js"></script>
<script type="text/javascript" src="jquery/ui.dropdownchecklist-1.4-min.js"></script>
<script type="text/javascript" src="fancybox/jquery.fancybox.js?v=2.0.6"></script>
<link rel="stylesheet" type="text/css" href="fancybox/jquery.fancybox.css?v=2.0.6" media="screen"/>
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
neeraj bharti
  • 361
  • 1
  • 3
  • 20

3 Answers3

1

Try to use jquery noConflict() and download the latest version of jquery that resolve some problems conflict

TRR
  • 1,637
  • 2
  • 26
  • 43
  • thanks its working on chrome and internet explorer but not woking on mozilla it genrate en error like $.jsonp is not a function.. – neeraj bharti Jun 13 '12 at 05:55
0

try this :

use jquery noconflict and wrap your code in jQuery functions :

http://api.jquery.com/jQuery.noConflict/

jQuery.noConflict();
jQuery(function($){
  // my code here each 
});

good luck.

mpm
  • 20,148
  • 7
  • 50
  • 55
  • thanks its working on chrome and internet explorer but not woking on mozilla it genrate en error like $.jsonp is not a function.. – neeraj bharti Jun 13 '12 at 05:54
0

The order in which you have declared your javascript, that is importing your MapmyIndia Js first, using it

<script type="text/javascript">
var map = $("#map");
var valid = new Validation();
map.MireoMap();
</script> 

& then calling jQuery, I don't think so jQuery would be creating problem.

Also you should be using

var map=document.getElementById("id");

since you are calling jQuery after that so $() won't work.

EDIT : Or if the MayMyIndia Js also requires jQuery then you should call jQuery.Js on top.

anuj_io
  • 2,043
  • 2
  • 13
  • 19