Jump to content

Search the Community

Showing results for tags 'fetch'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 2 results

  1. With JS fetch() it is a bit tricky to get for example $_POST populated (params need to be FormData / forms), but would it possible to get PW $input (get, post, urlSegments, queryString) working for fetch requests? Is there a fix / hook / workaround to solve it PW side?
  2. Hello, I'm trying to edit the field of a page with a value from a javascript fetch post request but I can't get the file_get_contents("php://input") or $_POST value in my PHP file. I created a `update` template and a `update` page (to allow access from fetch request and avoid 404/403/... errors) containing this code : $data = file_get_contents('php://input'); echo $data; # test edit the page field with random value #$home = $pages->get("/"); #$home->of(false); #$home->testfield = "test value"; #$home->save(); # test fetch response with random value #echo "test fetch response"; That I fetch request with my client javascript like this : fetch('/update', { method: 'POST', body: 'test' }) .then(function(response) { return response.text(); }) .then(function(data) { console.log(data); }) .catch(error => console.log('error')) } The field edit works fine and I get the test response from the `update` file but I can't get the posted value, I only get `<empty string>`. It is working fine outside of ProcessWire so I guess this is related to how PW handle $_POST ? I found this post where it seems to be working : Is there any way to get post value from javascript fetch request? What am I doing wrong? Thank you
×
×
  • Create New...