こんにちは、フォームなしで ajax GET 呼び出しが可能かどうかを知りたいです。
私は試した:
$(".edit_event").live("click", function() {
var currentID = $(this).data("event-id");
var currentTable = $(this).data("table");
if (currentTable == 'Coffee_talk') {
alert('Erzaehlcafe mit ID' + currentID);
$.ajax({
url: 'index.php?section=event_select&id=' + currentID + '&table=' + currentTable,
type: 'GET',
dataType: 'json',
success: function (select) {
alert(select);
}
});
return false;
} else if (currentTable == 'Presentation') {
alert('Vortrag mit ID' + currentID);
} else if (currentTable == 'Exhibition') {
alert('Ausstellung mit ID' + currentID);
}
});
Firebug でデバッグすると、ID とテーブルを使用した GET 呼び出しがありますが、値が返されません (json も php エコーもありません)。
これは私のphpです:
if ('GET' == $_SERVER['REQUEST_METHOD']) {
if ($_GET['table'] == 'Coffee_talk') {
echo ('test');
$response['code'] = '1';
echo json_encode($response);
}
if ($_GET['table'] == 'Presentation') {
}
if ($_GET['table'] == 'Exhibition') {
}
}
いくつかのテスト値を使用しました。