Your Laravel code is not the problem here. The problem may rather be in your JavaScript code that send the ajax request...
Try to remove the dataType and contentType options so that your ajax options look like that: $.ajax({type: "POST", data: myData, url: "http://tdc.dev/ajax"}); - you are not sending JSON content, but content encoded as "x-www-form-urlencoded" (which is the default content type).
( If you are using Chrome/Firefox, look in the developer tools to the network monitor and watch if your ajax request is correctly send to the server )
I'm not happy to remove the dataType: "json". I know, that I'm not sending json, but i need to recieve a response to my post in json... and I actually thought that dataType was the data format for the response and not the post/get format.
But still, not having anything else to go from I'll give it af try :-).
Thanks a bunch. Got a little confused in my response there. It was indeed the "contentType: 'application/json;". I changed that to contentType: 'charset=UTF-8' and now it works like a charm :-)
Scratch that! I removed contentType all together and it works!
Glad I could help you... ^^
NB: For UTF-8 encoding, from the jQuery docs:
POST data will always be transmitted to the server using UTF-8 charset, per the W3C XMLHTTPRequest standard
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community