I load a large dataset as JSON via $ .ajax, and some properties are lost during this download. For testing purposes, the server returns the first row where the property is missing.
Javascript
function parseResults(data) {
var send = [];
for (var x in data) {
var row = data[x],
code = row["ORDER"];
if (typeof code === "undefined") continue;
if (code == "") continue;
var temp = {
code: code,
date: row["CREATED DATE"] + " " + row["CREATED TIME"],
pt: row["PAYMENT_CODE"],
loc: row["LOCATION"],
fv: row["ORDER VOLUME"],
fpdf: row["DELIVERY FEE"],
fpsf: row["SERVICE FEE"],
vsf: row["REST. SERVICE FEE"],
pr: row["PAY RESTAURANT"],
to: row["TOTAL ORDER"],
delc: row["ORDER PROVIDER"],
city: row["City"],
vp: row["VENDOR PROVIDER"],
rest: row["VENDOR"],
vouch: row["VOUCHER AMOUNT"],
cust: row["CUST CODE"],
st: row["STATUS"]
};
send.push(temp);
}
sendResults(send);
}
function sendResults(data) {
for (var x in data) {
if (data[x].code == "m0sq-p0yq") {
console.log(data[x]);
}
}
$.ajax({
type: "POST",
url: "/ordersfp/process",
data: {
data: data
},
success: function(response) {
console.log(response);
}
}, "json");
}
Php
public function handleProcess()
{
$data = Input::all();
foreach ($data['data'] as $row) {
if (!isset($row['cust'])) {
return $row;
}
}
}
So, everything works as it should, the only problem is that this particular element with the code "m0sq-p0yq"somewhere loses the property cust.

In addition, I just noticed that the property is stalso lost. - Please help :)
source
share