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 8296327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:57:05+00:00 2026-06-08T14:57:05+00:00

I am using jQuery to edit my form which is built in Symfony .

  • 0

I am using jQuery to edit my form which is built in Symfony.

I am showing the form in jQuery dialog and then submitting it.

Data is entering correctly in database.

But I don’t know whether I need to send some JSON back to jQuery. Actually I am bit confused with JSON thing.

Suppose I have added a row in my table with “jQuery and when I submit the form then after data is submitted I want to send back those row data so that I can dynamically add the table row to show the data added.

I am confused how can get that data back.

This is my current code:

$editForm = $this->createForm(new StepsType(), $entity);

$request = $this->getRequest();

$editForm->bindRequest($request);

if ($editForm->isValid()) {
    $em->persist($entity);
    $em->flush();

    return $this->render('::success.html.twig');               
}

This is just the template with success message.

  • 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-08T14:57:06+00:00Added an answer on June 8, 2026 at 2:57 pm

    Symfony 2.1

    $response = new Response(json_encode(array('name' => $name)));
    $response->headers->set('Content-Type', 'application/json');
    
    return $response;
    

    Symfony 2.2 and higher

    You have special JsonResponse class, which serialises array to JSON:

    return new JsonResponse(array('name' => $name));
    

    But if your problem is How to serialize entity then you should have a look at JMSSerializerBundle

    Assuming that you have it installed, you’ll have simply to do

    $serializedEntity = $this->container->get('serializer')->serialize($entity, 'json');
    
    return new Response($serializedEntity);
    

    You should also check for similar problems on StackOverflow:

    • How to encode Doctrine entities to JSON in Symfony 2.0 AJAX application?
    • Symfony 2 Doctrine export to JSON
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My goal is to inline edit cells in a data grid using JQuery and
I have an edit form that I'm displaying as an overlay using Jquery Tools.
I am using the jQuery Jeditable (amazing script btw) to create an edit-in-place form.
Morning. I have a form which is rendered inside of a jquery dialog box
I am using jQuery-UI dialog in modal modal mode to display several Edit forms
I have a drupal form which i post using jquery when you select an
I am using struts2-jquery Dialog Widget to open a JSP page, which has a
I am using a jQuery jEditable edit-in-place field but when the JSON function returns
[edit] I am NOT using jquery in this app. Looking for a way to
I'm going to edit an ImageField using jquery ajax,after searching I found out 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.