Jquery ダイアログ ボックスを開いて、いくつかの異なるボタンを表示したいと考えています。クリックすると呼び出されるFacebookのUIフィードがあります(ダイアログボックス内に配置したいのですが、それは別の話です)。1 つのボタン (私の html に表示される最初のボタン) に対してのみ開いています。コードは次のとおりです。
<script>
$(function() {
$( "#dialog-modal" ).dialog({autoOpen: false, resizable: false, draggable: false, height: 250, width: 500, modal: true, dialogCLass: 'main-dialog-class'});
$( "#opener" ).click(function() {
$( "#dialog-modal" ).dialog( "open" );
$.getJSON(
"/like_artist.php", // The server URL
{ artist_id : $(this).data('artist_id') }, // Data you want to pass to the server.
function(json) {
var artist = json[1];
var text = '';
text = ' ' + artist ;
FB.ui({
method: 'feed',
// redirect_uri: '/index.php',
link: 'WEBPAGE',
name: '',
caption: '',
description: ''
});
$('#dialog-modal').text(text);
alert(artist);
}// The function to call on completion.
);
});
});
</script>
ボタン:
<button type="button" id="opener" data-artist_id="3">Play My City</button>
<button type="button" id="opener" data-artist_id="4">Play My City</button>
<button type="button" id="opener" data-artist_id="2">Play My City</button>
等...
ご協力ありがとうございました!