'I can't pull data from database because of $(this).data(temsilci_mail). I want to use email address as id'
$(document).ready(function() {
// Temsilci Listesi Modal
$('.temsilcibilgi').click(function() {
var userid = $(this).data('temsilci_mail');
$.ajax({
url: 'ajax-modal/temsilci-listesi-modal.php',
type: 'post',
data: {
userid: userid
},
success: function(response) {
$('.modal-body').html(response);
$('#temsilcilistesimodal').modal('show');
}
});
});
});
I suppose the $('.temsilcibilgi') selector return an array of button elements and you set up a temsilci_mail data to all of theses earlier. Because if you use $(this).data('temsilci_mail') you need to put the mail as a data before.
You can check if temsilci_mail data exist by logging button element like console.log($(this)) or by looking at the inspector and check that data-temsilci_mail attribute exist in each button.
If your problem is not that userid is undefined, then please give more precise information about your problem.