I am trying to send a variable that I get from an input to my controller in the following way
$(document).ready(function() {
$(".autocomplete").on('blur',function(){
var occ = $("#oculto_id").val();
$.ajax({
url: "{{ path('reg_validacion') }}",
type: "POST",
data: occ,
success: function(data) {
alert(data);
//si hago un alert(occ); me imprime la variable,lo que significa que el input no esta en null
}
});
});
});
but the alert (data) returns me:
and in the controller I'm not receiving anything.
public function validatection(Request $request)
{
$varpost=$request->query->get("occ");
dump($varpost);
die();
return $varpost;
}
Any suggestions on how I can get the occ value of the input in the controller?