I have a modal dialog box function that is set up with a javascript/jquery script that pops up when a user clicks a button. I pull data from the button to find out which button. But the text that pops up is set up in html with a div that calls the script function.
My question is, how do I customize this text based on the data I pull in the script.
Here is the relevant code below to give you an idea of what I'm trying to do:
The script:
<script>
$(function() {
$( "#dialog-modal" ).dialog({autoOpen: false, height: 250, width: 400, modal: true});
$( "#opener" ).click(function() {
$( "#dialog-modal" ).dialog( "open" );
$.get('/like_artist.php', {artist_id : $(this).data('artist_id')}, function(data) {
alert("Data Loaded: " + data.artist_id);
}, "json");
});
});
</script>
It is called in this div:
<div id="dialog-modal" title="Basic dialog">
<p>You have just liked </p>
<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
The button a user clicks (one of many with different data-artist_id values):
<div class="button_row">
<button type="button" id="opener" data-artist_id="1">Play My City</button>
</div>
Basically I would like to have the artist_id inform the div to make the text in the dialog box customized for each button.
Thank you very much for your help!