Hello stackoverflow community, I need help with my JavaScript. How can I transfer array with id of kasce?
When I'm printing array in ajax_import.php file, it prints nothing. So probably my array is empty.
Here is my code:
function SubmitImp() {
var import_tasken = document.getElementById("import_tasken");
//import_tasken.style.display = "none";
var kasce = document.getElementsByName("impTaskCh");
var array = "";
for (i = 0; i < kasce.length; i++) {
array[i] = kasce[i].getAttribute('id');
}
$.ajax({
type: "POST",
url: 'modules/projects/ajax/ajax_import.php',
data: {
data: array,
},
success: function(data)
{
alert("Viskas ok!");
}
});
}
arrayis clearly defined as a string, try creating an array instead