質問編集履歴
1
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -201,3 +201,95 @@
|
|
201
201
|
これがajax空の遷移先のPHPです。最上部付近にあるvar_dump(1)が表示されません。どこまでプログラムが進んでいるか分からず困っています。
|
202
202
|
|
203
203
|
よろしくお願いします。またPHPのエラーログも更新されていないです。
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
ちなみにメソッド機能は確認済みなので、動く方のPHPを貼ります。
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
```PHP
|
212
|
+
|
213
|
+
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
214
|
+
|
215
|
+
if (isset($_POST['hotelid'],$_POST['action'],$_POST['countrycode']) && $_POST['action'] == 'plus') {
|
216
|
+
|
217
|
+
try {
|
218
|
+
|
219
|
+
$hotelid = $_POST['hotelid'];
|
220
|
+
|
221
|
+
$action = $_POST['action'];
|
222
|
+
|
223
|
+
$countrycode = $_POST['countrycode'];
|
224
|
+
|
225
|
+
$dtabase->updateLikes($hotelid, $countrycode, $action);
|
226
|
+
|
227
|
+
$reslut = $dtabase->getLikes($hotelid, $countrycode);
|
228
|
+
|
229
|
+
header('Content-Type: application/json');
|
230
|
+
|
231
|
+
echo json_encode($reslut);
|
232
|
+
|
233
|
+
} catch (PDOException $e) {
|
234
|
+
|
235
|
+
return false;
|
236
|
+
|
237
|
+
}
|
238
|
+
|
239
|
+
exit;
|
240
|
+
|
241
|
+
} elseif (isset($_POST['hotelid'],$_POST['action'],$_POST['countrycode']) && $_POST['action'] == 'minus') {
|
242
|
+
|
243
|
+
try {
|
244
|
+
|
245
|
+
$hotelid = $_POST['hotelid'];
|
246
|
+
|
247
|
+
$action = $_POST['action'];
|
248
|
+
|
249
|
+
$countrycode = $_POST['countrycode'];
|
250
|
+
|
251
|
+
$dtabase->updateLikes($hotelid, $countrycode, $action);
|
252
|
+
|
253
|
+
$reslut = $dtabase->getLikes($hotelid, $countrycode);
|
254
|
+
|
255
|
+
header('Content-Type: application/json');
|
256
|
+
|
257
|
+
echo json_encode($reslut);
|
258
|
+
|
259
|
+
} catch (PDOException $e) {
|
260
|
+
|
261
|
+
return false;
|
262
|
+
|
263
|
+
}
|
264
|
+
|
265
|
+
exit;
|
266
|
+
|
267
|
+
} elseif (isset($_POST['hotelid'],$_POST['action'],$_POST['countrycode']) && $_POST['action'] == 'get') {
|
268
|
+
|
269
|
+
try {
|
270
|
+
|
271
|
+
$hotelid = $_POST['hotelid'];
|
272
|
+
|
273
|
+
$countrycode = $_POST['countrycode'];
|
274
|
+
|
275
|
+
$reslut = $dtabase->getLikes($hotelid, $countrycode);
|
276
|
+
|
277
|
+
header('Content-Type: application/json');
|
278
|
+
|
279
|
+
echo json_encode($reslut);
|
280
|
+
|
281
|
+
} catch (PDOException $e) {
|
282
|
+
|
283
|
+
return false;
|
284
|
+
|
285
|
+
}
|
286
|
+
|
287
|
+
exit;
|
288
|
+
|
289
|
+
}
|
290
|
+
|
291
|
+
}
|
292
|
+
|
293
|
+
```
|
294
|
+
|
295
|
+
こちらもAjaxからの処理です。
|