SHARE
TWEET

Untitled

a guest Nov 27th, 2012 740 Never
  1. <?php
  2. namespace D\FormBundle\Controller;
  3.  
  4. use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  5. use Symfony\Component\HttpFoundation\Response;
  6.  
  7. class MyAjaxController extends Controller
  8. {
  9.     public function indexAction()
  10.     {    
  11.         return $this->render('DFormBundle:Default:form.html.twig');
  12.     }
  13.    
  14.     public function updateDataAction(){
  15.          $request = $this->get('request');    
  16.          $data1 = $request->query->get('country');
  17.      
  18.  
  19.         //handle data
  20.  
  21.         //prepare the response, e.g.
  22.         $response = array("code" => 100, "success" => true);
  23.         //you can return result as JSON
  24.         return new Response(json_encode($response));
  25.     }  
  26. }
RAW Paste Data
Top