Friday, 1 March 2019

How to get POST global variable in PHP Symfony 4?

Actually, I have a very strange problem getting the result of a POST global variable in Symfony 4.

I tried this way :

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

This is how I actually send the AJAX request when the Calendar input's date changed :

onSelect: function(date, instance) {
    $.ajax({
      url : 'home',
      type : 'POST',
      data : {'date':date},
      dataType : 'html',
      success : function(code_html, statut){
        console.log(statut);
      },

      error : function(resultat, statut, erreur){

      },

      complete : function(resultat, statut){

      }          
    });

The onSelect callback successfully receive the date value I want.

And this result shows the 200 success code with right values for the date variable :

enter image description here

But $date still be NULL :(



from How to get POST global variable in PHP Symfony 4?

No comments:

Post a Comment