سلام وقت بخیر ما در فولدر جاوااسکریپت کدهایی که میزنیم علی رقم اینکه در فایل tpl-index.php سورس میدهیم بهش ولی فراخوانی نمیشود و لی به هنگامی که فایل اسکریپت را دربادی همون صفحه میندازمی فراخوانی میکند
فایل خدمتتون ارسال میکنم
html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>7Maptitle>
<link href="favicon.png" rel="shortcut icon" type="image/png">
<link rel="stylesheet" href="../assets/css/styles.css "/>
// این قسمت با اینکه سورس دادیم فراخوانی نمیشود
<script src="../assets/js/scripts.js">script>
//
<link rel="stylesheet" href="../assets/css/leaflet.css"/>
<script src="../assets/js/leaflet.js">script>
head>
<body>
<div class="main">
<div class="head">
<input type="text" id="search" placeholder="دنبال کجا میگردی؟">
div>
<div class="mapContainer">
<div id="map">div>
div>
div>
// مجبور شدیم بیاریم کدهای اسکریپت در اینجا
<script>
const defaultLocation = [35.6393181,51.3928281,17];
const defaultZoom = 15;
var map = L.map('map').setView(defaultLocation, defaultZoom);
L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
maxZoom: 18,
attribution: '7Learn.ac 7Map Project ',
id: 'mapbox/streets-v11',
tileSize: 512,
zoomOffset: -1
}).addTo(map);
document.getElementById('map').style.setProperty('height', window.innerHeight + 'px');
script>
//
<div class="modal-overlay" style="display: none;">
<div class="modal">
<span class="close">xspan>
<h3 class="modal-title">ثبت لوکیشنh3>
<div class="modal-content">
<form id='addLocationForm' action="= site_url('process/addLocation.php') ?>" method="post">
<div class="field-row">
<div class="field-title">مختصاتdiv>
<div class="field-content">
<input type="text" name='lat' id="lat-display" readonly style="width: 160px;text-align: center;">
<input type="text" name='lng' id="lng-display" readonly style="width: 160px;text-align: center;">
div>
div>
<div class="field-row">
<div class="field-title">نام مکانdiv>
<div class="field-content">
<input type="text" name="title" id='l-title' placeholder="مثلا: دفتر مرکزی سون لرن">
div>
div>
<div class="field-row">
<div class="field-title">نوعdiv>
<div class="field-content">
<select name="type" id='l-type'>
foreach(locationTypes as $key=>$value): ?>
<option value="=$key?>">=$value?>option>
endforeach; ?>
select>
div>
div>
<div class="field-row">
<div class="field-title">ذخیره نهاییdiv>
<div class="field-content">
<input type="submit" value=" ثبت ">
div>
div>
<div class="ajax-result">div>
form>
div>
div>
div>
<script src="../assets/js/scripts.js">script>
body>
html>
این هم فایل js
var map = L.map('map').setView(defaultLocation, defaultZoom);
L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
maxZoom: 18,
attribution: '7Learn.ac 7Map Project ',
id: 'mapbox/streets-v11',
tileSize: 512,
zoomOffset: -1
}).addTo(map);
document.getElementById('map').style.setProperty('height', window.innerHeight + 'px');
var map = L.map('map').setView(defaultLocation, defaultZoom);
L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
maxZoom: 18,
attribution: '7Learn.ac 7Map Project ',
id: 'mapbox/streets-v11',
tileSize: 512,
zoomOffset: -1
}).addTo(map);
document.getElementById('map').style.setProperty('height', window.innerHeight + 'px');