I'm getting an ajax failed when working with symfony2 in ajax.
Any ideas?
HTML
$.ajax({
url: "{{ path('destination_app_ajax') }}",
type: "post",
data: {
"json" : JsonData
},
success: function(JsonData){
$('#result').html(JsonData);
/* Clear all Data */
JsonData = "";
localStorage.clear();
alert("Data Sent!");
},
error:function(){
alert('ajax failed');
}
});
Controller
public function ajaxAction(){
$json = json_encode($_POST);
return new Response(array('json' => $json));
}