# AJAX POST request returns anti-bot HTML instead of JSON

**URL:** <https://forum.infinityfree.com/t/ajax-post-request-returns-anti-bot-html-instead-of-json/121564>\
**Category:** Hosting Support\
**Created:** [October 24, 2026, 3:37pm UTC](https://forum.infinityfree.com/t/ajax-post-request-returns-anti-bot-html-instead-of-json/121564 "2026-10-24T15:37:55Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![abi\_smartfit](https://forum.infinityfree.com/letter_avatar/abi_smartfit/32/6_449c533f586939b6e5f246632a46421f.png) [@abi\_smartfit](https://forum.infinityfree.com/u/abi_smartfit)\
**Post date:** [October 24, 2026, 3:37pm UTC](https://forum.infinityfree.com/t/ajax-post-request-returns-anti-bot-html-instead-of-json/121564/1 "2026-10-24T15:37:55Z")

</div>

### Website URL

[https://smartfitweb.rf.gd/](https://smartfitweb.rf.gd/)

### Error Message

Hello,

My website is [https://smartfitweb.rf.gd/](https://smartfitweb.rf.gd/)

When I submit my registration form, the POST request to `/backend/register.php` returns an HTML page containing `aes.js` and a `__test` cookie instead of JSON.

Opening the PHP endpoint directly works, but submitting the form using JavaScript `fetch()` returns the anti-bot HTML.

How can I fix this on InfinityFree hosting?

Thank you.

### Other Information

The issue occurs when submitting the registration form using JavaScript fetch() with a POST request. The server returns an anti-bot HTML challenge instead of JSON. JavaScript is enabled, and the \_\_test cookie exists in the browser.

Please help me resolve this issue.

---

<div class="post-metadata">

**Author:** ![system](https://infinityfree-forum-uploads.s3.dualstack.eu-central-1.amazonaws.com/original/3X/b/0/b024fd3fa88bae093c9576e55c2c94e33f890206.svg) [@system](https://forum.infinityfree.com/u/system)\
**Post date:** [October 24, 2026, 3:37pm UTC](https://forum.infinityfree.com/t/ajax-post-request-returns-anti-bot-html-instead-of-json/121564/2 "2026-10-24T15:37:55Z")

</div>

Welcome to the InfinityFree community forum! Good to have you here.

- Most people answering here are volunteers. They’re often the fastest source of help. Admin (the only staff member) checks in about once a day for issues on our end.
- Volunteers can’t see your account or website. Share what you actually see, like error messages and what happens when you try something. That’s more useful than your theory of what’s wrong.
- AI tools often get InfinityFree wrong. If a volunteer’s advice differs from what an AI told you, please try the volunteer’s suggestion first.
- Solving an issue is a joint effort. Try the suggestions you get and report back what happened.

---

<div class="post-metadata">

**Author:** ![Lemni](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/lemni/32/68303_2.png) [@Lemni](https://forum.infinityfree.com/u/Lemni)\
**Post date:** [October 24, 2026, 3:38pm UTC](https://forum.infinityfree.com/t/ajax-post-request-returns-anti-bot-html-instead-of-json/121564/3 "2026-10-24T15:38:05Z")

</div>

_Beep boop, I’m a bot! I dug through the forum to get you started. I sometimes get things wrong though, so do with this what you will until a human has a look._

The security check doesn’t block same-domain AJAX. The article on it says JavaScript calls to your own website’s endpoints work fine, and it says cross-domain (CORS) requests are blocked.

So a `fetch()` that gets the `aes.js` page usually means the request isn’t treated as same-site. That could happen if the page runs on a different address than the endpoint, such as a different domain, a `www` and non-`www` mix, `http` against `https`, or a local file or dev server.

What exact URL is in your `fetch()` call, and what address is in the browser bar when you submit the form?

The article that describes the check:

> [@Browser Security System - Features and Limitations](https://forum.infinityfree.com/docs?topic=49353):
>
> InfinityFree uses a security system on all free hosting accounts to ensure your website is accessed by real web browsers, not bots or automated scripts. While this protects your site from malicious traffic, it can affect certain types of access. How the security system works The system checks that visitors can execute JavaScript and accept cookies: features that all modern web browsers support. This verification happens automatically and most website visitors will never notice it. You may occa…

---

<div class="post-metadata">

**Author:** ![abi\_smartfit](https://forum.infinityfree.com/letter_avatar/abi_smartfit/32/6_449c533f586939b6e5f246632a46421f.png) [@abi\_smartfit](https://forum.infinityfree.com/u/abi_smartfit)\
**Post date:** [October 24, 2026, 3:43pm UTC](https://forum.infinityfree.com/t/ajax-post-request-returns-anti-bot-html-instead-of-json/121564/4 "2026-10-24T15:43:47Z")

</div>

The registration page URL is:  
[https://smartfitweb.rf.gd/register.html](https://smartfitweb.rf.gd/register.html)

The browser origin is:  
[https://smartfitweb.rf.gd](https://smartfitweb.rf.gd/)

My fetch request is:  
fetch(“backend/register.php”, { method: “POST”, body: data });

Both the page and endpoint use the same HTTPS domain, but the POST request still returns the aes.js anti-bot HTML instead of JSON.

What should I check next?

---

<div class="post-metadata">

**Author:** ![abi\_smartfit](https://forum.infinityfree.com/letter_avatar/abi_smartfit/32/6_449c533f586939b6e5f246632a46421f.png) [@abi\_smartfit](https://forum.infinityfree.com/u/abi_smartfit)\
**Post date:** [October 24, 2026, 6:47pm UTC](https://forum.infinityfree.com/t/ajax-post-request-returns-anti-bot-html-instead-of-json/121564/5 "2026-10-24T18:47:31Z")

</div>

Hi, thank you. I have confirmed the following:

1. The registration page and PHP endpoint use the same HTTPS domain.

2. The database connection test succeeds.

3. Opening `backend/register.php` directly returns the expected JSON error for an invalid GET request.

4. Submitting the registration form with POST returns HTTP 200, but the response is the `/aes.js` anti-bot HTML instead of JSON.

5. I tested in Microsoft Edge and InPrivate mode, with the same result.

Could a human support staff member please investigate why this POST request is being intercepted by the security system? Is there a recommended workaround for PHP form submissions on free hosting?

Thank you.

---

<div class="post-metadata">

**Author:** ![Admin](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/admin/32/36437_2.png) [@Admin](https://forum.infinityfree.com/u/Admin)\
**Post date:** [October 26, 2026, 10:31am UTC](https://forum.infinityfree.com/t/ajax-post-request-returns-anti-bot-html-instead-of-json/121564/6 "2026-10-26T10:31:47Z")

</div>

I’m sorry for the delay.

For starters, HTTP POST requests, AJAX, form submissions and everything related to that should just work.

I just tested it, and I was able to complete the registration without issues. You may want to remove the registration for “example example” from your records.

I investigated a very similar issue for someone else yesterday, and I suspect it’s the same issue. Can you check what I wrote there and see if it also explains what’s happening for you?

> [@Booking Form POST Requests Blocked by Security Verification – carpdiexpert.in](https://forum.infinityfree.com/t/booking-form-post-requests-blocked-by-security-verification-carpdiexpert-in/121522/13):
>
> I finally dug into this, and I found some behavior that I wasn’t even aware of. Your website itself worked fine for me when using a normal browser (I had to create few bookings to test, you’ll want to delete those), but I found something interesting while prodding it. I just learned that the \_\_test cookie is not a static value that’s the same for everyone. It seems to vary based on request data, at least including the User Agent. And that matters, because the request data you shared before inc…

---

<div class="post-metadata">

**Author:** ![system](https://infinityfree-forum-uploads.s3.dualstack.eu-central-1.amazonaws.com/original/3X/b/0/b024fd3fa88bae093c9576e55c2c94e33f890206.svg) [@system](https://forum.infinityfree.com/u/system)\
**Post date:** [November 2, 2026, 10:31am UTC](https://forum.infinityfree.com/t/ajax-post-request-returns-anti-bot-html-instead-of-json/121564/7 "2026-11-02T10:31:50Z")

</div>

Closed on November 2, 2026, 10:31am UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
