BUGFIX: HTTP 400 'Invalid request' when saving editable complaint fields
PROBLEM: After adding the route, the request still returned 400 Bad
Request with 'Invalid request' error. The controller's isAJAX() check
was failing and rejecting the request.
ROOT CAUSE: The fetch() API does not automatically add the
X-Requested-With header that CodeIgniter 4's isAJAX() method checks
for. Unlike jQuery.ajax() which adds this header by default, vanilla
fetch() requires explicit header configuration.
SOLUTION: Added 'X-Requested-With': 'XMLHttpRequest' header to the
fetch request in attachComplaintFieldHandlers() function. This is the
standard header that identifies AJAX requests and is what CI4's
Request::isAJAX() method validates.
Now the editable complaint fields save correctly:
- Type in complaint name/remark
- Press Tab or Enter
- Green border = saved successfully
- Changes persist in database