Click here to Skip to main content
15,879,095 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
So I have this function that sets an achievement in my database and returns infos about the achievement to be displayed on a bootstrap 3 modal.

function setAchievement(idAchievement){
        url: "http://localhost:8080/licenta/setAchievement",
    }).then(function(data) {
        if (data.description != "null"){ // if update was made
            $("#description").text(data.description); // set the divs with infos received about the achievement
    $("#achievementsModal").modal("show");  // display the modal
    $( "#continue" ).click(function() {  // close the modal when the continue button is clicked

This works just fine when I call the function only once like this:


But sometimes the user can do 2-3 achievements so I need to display 2-3 modals(when i close one, the next one should open).

Here comes my problem, even if my database updates with all 3 achievements , on the view page only one modal opens(for the first setAchievement(0) call).

I can't see a workaround for this problem. Any tips would be great. Thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900