I tried a lot of solutions found here to accomplish my goal, but unfortunately none of these seems to work for what I want.
I've got a list of (let's say) users, loaded from a MySQL database by a loop. Now I want a button for every user's name that opens a modal with additional info.
The list is something like:
<li><a class='btn btn-default' data-toggle='modal' data-target='myModal' href='user.php?userid=1'>User 1</a></li>
<li><a class='btn btn-default' data-toggle='modal' data-target='myModal' href='user.php?userid=2'>User 2</a></li>
Inside the modal, there should run another MySQL query to get more data from the DB depending on the passed variable (i.e. userid=1).
Where do I put now the code for #myModal? If I place it completely (or partially) in user.php, the modal backgrounds shows up, but no modal. If I place it somewhere in the file with my links, it doesn't load the remote file. Also, I can't change the modal title dynamically (which should read i.e. "User 1").
And then there is the problem with reloading other user data when clicking on a link again.
Can anyone provide me with some hints on how to do this?