I have 2 files. One html.twig , second php . In php there are classes with functions that return some data arrays in html.twig . It is necessary that the request in php and back occur without reloading the page. That is, let's say there is a list of products, clicked on the checkbox "only new" and only new ones appeared without reloading the page. I'm not puzzling the first day, could you write any example?
1 answer
Here you are .
function addPosToRoute(posId, routeHeadId) { $.ajax({ url: "{{ path("Nitra_OutletBundle_Pos_To_Route") }}", type: 'post', data: { pos: posId, routeHead: routeHeadId, add: $('#' + routeHeadId).is(':checked'), }, success: function(data) { if ((data != "Ko")) { $('#count_' + routeHeadId).html(data); } } }); } |