zakazivanjeTermina.js
So the what the code from the zakazivanjeTermina.js is it goes to the database, reads the database and fills the terminTrener with the Coaches of the Gym. The problem is when I add bootstrap the php file doesn’t see the script. Can’t even call a console.log() from it
<script>
$(document).ready(function(){
$("#terminVrstaTreninga").click(function(){
$("#terminTrener").empty();
let izbor = $("#terminVrstaTreninga").val();
$(document).ready(function(){
$.get("ajax/ajax.php?func=treneri&vrstaTreninga="+izbor, function(odg){
let treneri = JSON.parse(odg)
for(i=0;i<treneri.length;i++){
$("#terminTrener").append("<option ``value="+treneri[i].id+">"+treneri[i].ime+"</option>")
}
})
})
})
}
</script>
php page
<select class="form-select" name="terminVrstaTreninga" id="terminVrstaTreninga">
<option value="grupni">Grupni</option>
<option value="individualni">Individualni</option>
</select>
<br>
<label for="terminTrener" class="form-label text-start">Odaberite trenera</label>
<select class="form-select" name="terminTrener" id="terminTrener">
</select>
need to fill the terminTrener with the jQuery
2
Answers
I am still not sure whats going on but I tried everything, but nothing worked, so I deleted the part where I included Bootstrap and then added it back. Now, everything works normally....
The JavaScript on your website is running before the jQuery is fully loaded. Or perhaps a JavaScript file is not being correctly loaded when the page loads. The CDN that you’re using to improve your site performance was unable to reach your server.