Answer the question
In order to leave comments, you need to log in
How to pass post via ajax for new routing in Sonate?
Created a new route
protected function configureRoutes(RouteCollection $collection)
{
$collection->add('ajax', '/ajax', array(), array(), array(), '', array(), array('POST'));
}
$.ajax({
type: "POST",
dataType: 'json',
url: "/hrm/hrm/reminder/reminder/ajax",
data: {number: $('#numberReminder').val()},
cache: false,
success: function(res){
console.log(res.message);
},
error: function(error){
console.log(error);
}
});
public function ajaxAction(Request $request){
$number = $request->get('number');
...
}
No route found for "POST /hrm/hrm/reminder/reminder/ajax"
Answer the question
In order to leave comments, you need to log in
Read the doc, ask Google questions first.
Learn to search for information.
symfony.com/doc/current/book/http_fundamentals.htm...
https://sonata-project.org/bundles/admin/master/do...
// ...
use Sonata\AdminBundle\Route\RouteCollection;
protected function configureRoutes(RouteCollection $collection)
{
$collection->add('clone', $this->getRouterIdParameter().'/clone');
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question