skip to Main Content

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


  1. Chosen as BEST ANSWER

    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....


  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search