Advertisement
Guest User

Untitled

a guest
Apr 5th, 2020
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class API {
  2.  
  3.   constructor(url,type,dataType, map){
  4.     this.url = url;
  5.     this.type = type;
  6.     this.dataType = dataType;
  7.     this.map = map;
  8.   }
  9.  
  10.   ajaxMethode(){
  11.     $.ajax({
  12.       url : this.url,
  13.       type : this.type,
  14.       dataType : this.dataType,
  15.       success : function(APIjcd,statut){
  16.         //  allStations = APIjcd;
  17.           APIjcd.forEach(function(station){
  18.             this.map.createStation(station);
  19.           }.bind(this))
  20.           this.map.markerListener('click');
  21.           this.map.markerCluster();
  22.       }.bind(this)
  23.     })
  24.   }
  25. }
  26.  
  27. $(function(){
  28.   var map = new MapInterface(document.getElementById('map'));
  29.   map.initMap({ center: {lat: 43.600000, lng: 1.433333}, zoom: 16 });
  30.  
  31.   // VAR ajax
  32.   var APIjcd = new API($url,'GET','JSON', map);
  33.   APIjcd.ajaxMethode();
  34. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement