Skip to content

Commit

Permalink
Fix #71 (Unrelated XHRs are erroneously handled)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmb69 committed Feb 6, 2023
1 parent 39e5c89 commit 10ce560
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion classes/CalendarController.php
Expand Up @@ -119,7 +119,7 @@ public function defaultAction(): Response
'rows' => $rows,
'jsUrl' => "{$this->pluginFolder}js/calendar.min.js",
];
if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) {
if (isset($_GET['calendar_ajax'])) {
return Response::createAjax($this->view->render('calendar', $data));
}
$output = '<div class="calendar_calendar">'
Expand Down
2 changes: 1 addition & 1 deletion js/calendar.min.js
Expand Up @@ -44,7 +44,7 @@ class CalendarWidget {
retrieveCalendar(url, isPop) {
var request = new XMLHttpRequest();
this.element.classList.add("calendar_loading");
request.open("GET", url, true);
request.open("GET", url + "&calendar_ajax", true);
request.setRequestHeader("X-Requested-With", "XMLHttpRequest");
request.onload = () => {
if (request.status >= 200 && request.status < 300) {
Expand Down

0 comments on commit 10ce560

Please sign in to comment.