• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: I can’t get PUT data in PHP from jQuery Ajax request

Resolved: I can’t get PUT data in PHP from jQuery Ajax request

0
By Isaac Tonny on 18/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

When I try to access the form data I send with a jQuery AJAX PUT request, I get this response:

Array ( [——WebKitFormBoundary4TPPQZu7B7WFrUsv Content-Disposition:_form-data;_name] => "id" 7 ——WebKitFormBoundary4TPPQZu7B7WFrUsv Content-Disposition: form-data; name="naam" Eiusmod alias est do ——WebKitFormBoundary4TPPQZu7B7WFrUsv Content-Disposition: form-data; name="email" zatapohopu@mailinator.com ——WebKitFormBoundary4TPPQZu7B7WFrUsv Content-Disposition: form-data; name="adres" Voluptates adipisici ——WebKitFormBoundary4TPPQZu7B7WFrUsv Content-Disposition: form-data; name="telefoonnummer" 0612345678 ——WebKitFormBoundary4TPPQZu7B7WFrUsv Content-Disposition: form-data; name="rol" 4 ——WebKitFormBoundary4TPPQZu7B7WFrUsv– ) Warning: Undefined array key "id" in C:\xampp\htdocs\P08\hoornhek\api\gebruiker.php on line 22


I also can’t get the array keys. This is my jQuery AJAX request:
And this is my PHP (API) code:
For my GET, POST and DELETE requests everything works fine. What am I doing wrong?

Answer:

You cant access the data from a PUT request via $_REQUEST. You’d need something like:
See also Accessing Incoming PUT Data from PHP

If you have better answer, please add a comment about this, thank you!

ajax jquery php put request
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: Create From/To Pairs by sequential date R dplyr

22/03/2023

Resolved: Using a variable on next page before the if(isset statement

22/03/2023

Resolved: What is a difference between TextStyle.FULL and TextStyle.FULL_STANDALONE

22/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.