I'm trying to fire off a request to my controller via a DOJO request,
request("/category/", {
method: "PUT",
data: {
original: event.target.getAttribute("data-original"),
edited: event.target.getAttribute("data-edited"),
id: event.target.getAttribute("data-id")
}
}).then(function(response) {
response = JSON.parse(response);
if(response.success) {
createRow(response.id);
} else {
// handle validation errors here
}
});
Which fires a PUT request to my /category/
route, which is picked up and sent to the controller, at this point I'd like to access the $_PUT
superglobal which I believe doesn't exist the same way you would access the $_POST
superglobal.
public function putIndex()
{
try {
try {
$this->category->edit(
new CategoryVO($request['id'], $request['original']),
new CategoryVO($request['id'], $request['edited'])
); // This is where I'd like to access the values sent in the PUT request
echo json_encode(
array(
"success" => true
)
);
} catch (CategoryValidation $validationException) {
echo json_encode(
array(
"success" => false,
"validation_errors" => $this->service->prepareErrors(
$validationException
)
)
);
}
} catch(\Exception $e) {
echo json_encode(
array(
"success" => false,
"unexpected_exception" => true
)
);
}
}
FYI: Custom built framework so don't have any of those nice features that zf2/codeigniter may come with.