json 形式の ajax を使用して UTF-8 でエンコードされたデータベースからデータを取得しようとしたときに、データに Ä、Ö、Ü、ä、ö、ü などの特殊文字が含まれている場合、結果セットは空です。
$('.club-details').click(function() {
var element = $(this);
var data = {
gid: $(this).parent().parent().parent().parent().data('gid'),
club_number: $(this).parent().parent().data('club')
};
$.ajax({
type: 'POST',
url: TRANSFER_CALLS_URI,
data: 'key=getClubDetails&data=' + JSON.stringify(data),
dataType: 'json',
success: function(response) {
var html = "";
html += "<table>";
html += " <tr>";
html += " <td>Name kurz</td>";
html += " <td>" + response[0].name_short + "</td>";
html += " </tr>";
html += " <tr>";
html += " <td>Schießstätte</td>";
html += " <td>" + response[0].location + "</td>";
html += " </tr>";
html += " <tr>";
html += " <td>Telefon</td>";
html += " <td>" + response[0].phone + "</td>";
html += " </tr>";
html += "</table>";
element.unbind('click').popover({
content: html,
title: 'Vereinsinformation',
html: true,
placement: 'bottom'
}).popover('show');
},
error: function() {
$.error('Ajax');
}
});
});
ドイツ語の特殊文字を含まないデータ レコードは、正常に受信および表示されます。