I can't push the value of my array to my php file.
Script:
<script>
$(document).ready(function() {
var item_code = [];
$('#save').click(function() {
var item_name = [];
var item_value = [];
var item_quantity = [];
for (var i = 0; i < item_code.length; i++) {
item_code.push($(this).val());
}
$('.item_name').each(function() {
item_name.push($(this).val());
});
$('.item_value').each(function() {
item_value.push($(this).val());
});
$('.item_quantity').each(function() {
item_quantity.push($(this).val());
});
$.ajax({
url: "insert2.php",
method: "POST",
data: {
item_name: item_name,
item_code: item_code,
item_value: item_value,
item_quantity: item_quantity,
},
success: function(data) {
}
});
</script>
I have a value storing at "item_code" whenever I search the item code on my search bar. And after that, I want to push the value of item_code[] on the insert2.php.
I'm not getting any error, but the system itself is frozen.