Jump to content
rhythm

PrestaShop ignores POST JSON data

Recommended Posts

Hey,

I am sending data to custom PHP file on Prestashop in JSON format, with the header Content-Type: application/json.

I tried Tools::getValue and _POST("MyVariable"), var_dump(_POST) shows nothing. If I select to send it as a form data, everything appears.

However, that's not the choice I have. I need to POST JSON data to PRESTASHOP and use it on my custom controller. 

Edited by rhythm (see edit history)

Share this post


Link to post
Share on other sites

I think u need add a header to your request:

headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'} 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More