Leaflet markerclusters are not working in my website..The website works perfectly fine in localhost

Username (e.g. epiz_XXX) or Website URL

https://shabnaseethi.epizy.com/project1/

(please specify the website or account you are asking about)

Error Message

(please share the FULL error message you see)

Failed to load resource: the server responded with a status of 404 ()

Other Information

(other information and details relevant to your question)

No issue

The map has layer control to view airports which are displayed as map clusters and those are not working.

I see one resource that failed to load: the favicon of your page. You did not specify an icon link tag, so browsers will look for a favicon on https://shabnaseethi.epizy.com/favicon.ico. This file also does not seem to exist

I don’t know what “leaflet markerclusters” are, but all the URLs on your site seem to load and no errors are logged in the console.

The code at https://shabnaseethi.epizy.com/project1/libs/js/script.js seems that it should add markers for airports or something like that? And this data should be loaded through AJAX? I do see an AJAX request go out to getCountries.php, but nothing else.

My best guess is that it has something to do with Javascript Promises, global scope, sync vs. async code and so on. More specifically: on your own computer, an AJAX request will be very fast since it’s local. On a remote server, it will be slower. And if you read a variable under the assumption that it contains data, but the AJAX request to put that data in hasn’t finished yet, then indeed nothing will be shown.

But this is all speculation. It’s your Javascript code that’s not rendering the markers. You wrote the code, it runs in your browser, we can’t change how code is run in your browser even if we wanted to. This is definitely not a hosting issue.

6 Likes

it seems that the API for the list of airports see server IP (not client IP)
and then returns only GB list of airports


2

Probably because you are doing it through PHP (internal communication) and you don’t have the code in it
to get the “client IP” and submit it to the airport API (so that API sees the server IP)

and selecting a country from the menu has no effect at all, although it should…
so the logic (sequence of events) of your code should be different

probably something like this should be the sequence of events:
connect the selected country (from menu) with a list of airports and retrieve/pass the user’s IP/or selected country from the menu to that airport API (airlabs.co) so that it returns the correct list of airports.

Screenshot 2023-02-04 102853

the website requested GEO access to the location, but it has no effect

4 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.