'I display a table with ajax in real time and I check some lines which I return in my views
I have this problem in summary: when i fill my input automatically i display an array using ajax , and on the same table I shock a few lines and when I send back to my views through a button I have nothing that is displayed either at the console or the terminal.
Js & Ajax
enter code here
$(document).on("click","#final",function(){
const list_entrepot = getSelectedVals1();
const list_fournisseurs = getSelectedVals();
selection = {list_fournisseurs,list_entrepot};
$.ajax({
async: false,
type : "GET",
url : 'fournisseur_ajax',
data :{
'csrfmiddlewaretoken': csrf,
'selection':selection,
},
success : (res) =>{
console.log(res.data)
}
});
});
function getSelectedVals(){
var tmp =[];
$("input[name='fournisseur_tab']").each(function() {
if ($(this).prop('checked'))
{
checked = ($(this).val());
tmp.push(checked);
}
});
var filters = tmp.join(',');
console.log(filters)
return filters;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|