Hi All,
I have a jquery function that will reset a column to 0 in a SQL table depending on the Barcode inputted by the user.
The function executes when the Barcode is in the textbox and the user clicks ‘reset carrier’, but when the user clicks ‘add to list’ to add to the barcode to the listbox, it brings back an error when clicking ‘reset carrier’, which is one my error validations if the barcode is not 8 characters long. This is my function…
** function resetCarrier() {
var barcode = document.getElementById(“barcode”).value.toUpperCase();
console.log(barcode);
//document.getElementById("errorMessage").innerHTML="";
$("#errorMessage").text("");
document.getElementById("barcode").value="";
$.post("carrierResetProcedure.php",{barcode: barcode},function(data, status){
console.log("Data: '"+data+"'");
if(data=='') {
$("#errorMessage").html('<div class="alert alert-success"><strong>'+barcode+' carrier successfully updated.</strong></div>');
}
else {
$("#errorMessage").html('<div class="alert alert-danger"><strong>ERROR: '+data+'<br>No change has been made to the data.</strong></div>');
$("#errorMessage").html("ERROR: "+data+"<br>No change has been made to the data.");
console.log(data);
//document.getElementById("errorMessage").innerHTML=data;
}
});
}
Any help would be greatly appreciated, as I can’t figure out where i’m going wrong.
Thanks.