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

(02-20-2021, 10:33 AM)iRedds Wrote:
(02-20-2021, 09:15 AM)superior Wrote: 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();.

Congratulations. But why did you put the header then?

Something I already forgot how this your jQuery works.  Big Grin

Exclamation $_POST An associative array of variables passed to the current script via the HTTP POST method when using application/x-www-form-urlencoded or multipart/form-data as the HTTP Content-Type in the request.


Haha thnx!
To be honest, no clue why this was put there. Never did this before so there shouldn't be a reason for it now.. Maybe because i've been looking for the X-CSRF-TOKEN header but i never used it before on projects with an Ajax request.
Reply


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



Theme © iAndrew 2016 - Forum software by © MyBB