Jump to content

Milo

Members
  • Posts

    3
  • Joined

  • Last visited

Milo's Achievements

Newbie

Newbie (2/6)

0

Reputation

  1. okay, thx, i know those threads and both say in some posts that you can get the request in the module init function, so i thought i just forgot something .. but as it dont works for you either i will move to the solution with the hidden admin page.
  2. Hello, if my post was confusing. I'm implementing a new inputfield to upload images to a cloudservice. When you edit a page in the backend with this inputfield, lets call it InputfieldCloud, you can upload multible images and they are displayed. Now i want to add a remove button, in case i upload a false image or whatever.. When the user clicks on the remove button i want to trigger an AJAX call to the InputfieldCloud class. This works with a GET request, but fails with a POST request. I can do everything with the GET request.. i'm just curios how to implement POST communication between: InputfieldCloud Class <-> InputfieldCloud "view" of my Module
  3. I'm new to processwire and i'm looking for a solution to handle post requests with inputfields. At the moment my code looks like this: class InputfieldTest extends Inputfield { ... public function init() { if($this->config->ajax && $this->input->InputfieldTest){ header('Content-Type: application/json'); echo "{'test':'test'}"; exit; } } ... } And then there is a JS file with: var testdata = { InputfieldTest: 'InputfieldTest' }; testdata[$('#testa-tokenname').text()] = $('#testa-tokenvalue').text(); $.ajax({ url: "http://bla.at/processwire/page/edit/?id=1816&InputfieldTest=1", data: testdata, type: 'POST', success: function(json) { alert(json); } }); Everything works fine with a GET request, but with the POST i just get the message {"error":false,"message":"AJAX Page not saved (no changes)"} Any ideas? Or is it all wrong and i should use a different approach?
×
×
  • Create New...