$(function () {
$('#sendit').click(function () {
var user_id =$('#user_id2').val();
var all =$('#Senditem').find("input[name='forall[]']").map(function(){return $(this).val();}).get();
var session = $('#sessionit').val();
var dateit=Date.now();
var thisdata='<span style="color: red">No User Selected';
var div2 = document.getElementById('resultshere');
div2.innerHTML = '';
if (user_id < 1){
var div = document.getElementById('resultshere');
div.innerHTML = thisdata;
}else {
var posting =
$.get(
$(this).data('url'),
{
senddate: dateit,
session: $('#sessionit').val(),
user_id: $('#user_id2').val(),
inputmade: $('#Senditem').find("input[name='forall[]']").map(function () {
return $(this).val();
}).get()
});
$('#destinationtable tr:first').after('<tr><td>'
+ user_id + all + session + '</td><td> <input name="inputmade" value="'+ dateit+'pim'+user_id+'pim'+all+'pim'+session+ '">waiting to insert ..</td></tr>'
);
at a button click the content in input field are collected in an array and pushed to be saved . then the array content gets append to another table. which will later be accessed and saved again every 5 seconds by another javascript below. The issue is, the javascript below never gets the the correct array format
(function autoinsert() {
var input=$("#destinationtable td:last").find("input").val();
// alert(input);
var req = $.ajax({
type:"get",
url:"{{route('AjaxInsertTuckshopIssueAuto')}}",
data: {postthis: input},
error: function() {
},
success: function(data) {
$('#resultshere').html(data)
if (input == data ) {
function deleterow(tableID) {
var table = document.getElementById(tableID);
var rowCount = table.rows.length;
table.deleteRow(rowCount -1);
}
deleterow("destinationtableTable");
}
},global: false
}); setTimeout(autoinsert,5000);
})();