Welcome Guest, Not a member yet? Register   Sign In
Ajax post not working, can't figure this one out
#6

(This post was last modified: 02-20-2021, 09:27 AM by superior.)

(02-20-2021, 09:04 AM)iRedds Wrote: If you are sending JSON then the getGet/getPost/getGetPost/getPostGet methods will not work as they access the $_GET and $_POST arrays.
Use getJSON, getJsonVar or getVar methods to get data

Retrieving Input (scroll to "Getting JSON data" section)

Thank you for the documentation page, i'm receiving an HTTP 500 (Internal Server.....).

Request:
[Image: Request.png]

Error:

[Image: HTTPError.png]

Not a single one of your sugestions seem to work, i don't think it's a bug in CI4 otherwise someone else would have spotted way before i did?


EDIT:
And just like that i've found the problem, the header send in the Ajax request 'Content-Type: application/json' caused my issue. The minute i removed that from the headers array i'm receiving the post with $request->getPost();.
Reply


Messages In This Thread
RE: Ajax post not working, can't figure this one out - by superior - 02-20-2021, 09:15 AM



Theme © iAndrew 2016 - Forum software by © MyBB