I've a route defined this way:
order_request:
class: sfDoctrineRouteCollection
options:
model: OrderRequest
module: order
prefix_path: /order
column: id
with_wildcard_routes: true
Trying to post data from a form with ajax this way.
$.post('order/1578/exportPostsToProject', jsonString, function(data) {
...
});
1578 is the Id of the order. The Id is not strictly required but it's there. But the problem is that as soon as I try do do the ajax request with POST i get this error:
POST http://184.95.x.xx/backend.php/order/1578/exportPostsToProject 404 (Not Found)
If I change the POST in GET the error doesn't appear and all works properly. How can I solve this problem ? I need to POST the data.
my controller:
public function executeExportPostsToProject(sfWebRequest $request)
{
$orderRequest = $this->getRoute()->getObject();
$this->order_request = $orderRequest;
$this->orderPostList = $orderRequest->getOrderGeneratedPosts();
if ($request->isXmlHttpRequest())
{
$settingsString = $request->getParameter('settingsStr');
}
}
You should add an object route to the collection which explicitly allows POST requests. E.g:
order_request:
class: sfDoctrineRouteCollection
options:
model: OrderRequest
module: order
prefix_path: /order
column: id
with_wildcard_routes: true
object_actions:
export: [get, post]