Here follows my problem. In a Symfony2.1 controller I receive an Ajax call. If I use the Request object I’m not able to get the sent param. If I use the PHP _REQUEST object the param is found!
I can confirm that the request is XHR, if it matters.
Here is my code:
public function savedataAction(Request $request){
if($request->isXmlHttpRequest())
echo 'Ajax Call';
$param1 = $request->request->get('myParam'); // Nothing is returned, but $request is obviosly not null
$param2 = $_REQUEST['myParam']; // The value is given
....
}
Any idea?
PS: If helps, notice that the AJAX call is sent by the file uploader jQuery plugin provided by Valums.
Normally its:
Look here are the fundamentels.
http://symfony.com/doc/current/book/http_fundamentals.html
Edit:
$requestin your case is only filled when you send the form from the Symfony2 site. It is possible, that the CSRF protection block the request.Try this in your controller to get the Request object:
http://symfony2forum.org/threads/5-Using-Symfony2-jQuery-and-Ajax