Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8880457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:10:07+00:00 2026-06-14T20:10:07+00:00

Here follows my problem. In a Symfony2.1 controller I receive an Ajax call. If

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T20:10:08+00:00Added an answer on June 14, 2026 at 8:10 pm

    Normally its:

    // retrieve GET and POST variables respectively
    $request->query->get('foo');
    $request->request->get('bar', 'default value if bar does not exist');
    

    Look here are the fundamentels.

    http://symfony.com/doc/current/book/http_fundamentals.html

    Edit:

    $request in 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:

    $request = $this->get('request');
    

    http://symfony2forum.org/threads/5-Using-Symfony2-jQuery-and-Ajax

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Newbie here! My problem is as follows: I have a dynamically populating ul where
Basic problem here.. I will start off by asking that you please not respond
This question follows on from the problem posted here when i run explain I
I've got a scope problem here. and no idea why its not working, ive
I'm solving a problem mentioned here I was able to do custom format of
I have two simple questions that concern the exceptions in Symfony2. Here follows the
I'm trying to follow the Django tutorial (for v1.1) here . the problem that
I'm using jquery to submit my form (with id #myForm here) as follows: $(document).ready(function()
Here's some code (full program follows later in the question): template <typename T> T
Here is my situation, I have a string as follows 'a':1 'b':2 'c':3 I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.