While attempting to call the UpdateItem function using AJAX with an anchor tag, I encountered a console error.
Error : req is undefined
function updateItem(id, desc, vehicleno){
alert("i am here");
$('#ProcessModal').modal('show');
$('#<%=txtPartNo.ClientID%>')[0].value=id;
$('#<%=txtPartNo.ClientID%>')[0].value=partno;
}
Initiating Ajax call...
......
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "<%=BasePath%>/WebServices/RequisitionService.asmx/GetAllRequisitionItems",
data: '{ ReqID: "<%=_RecordId%>"}',
dataType: "json",
success: function (data) {
var req=[];
var desc=[];
var veh=[];
for (var i = 0; i < data.d.length; i++) {
req[i] =data.d[i].RequisitionItemsID;
desc[i]= data.d[i].ItemDescription;
veh[i]= data.d[i].VehicleNumber;
$("#reqTable").append("<tr><td>"+data.d[i].PartNo + "</td><td>" + data.d[i].ItemDescription +"</td><td>"+data.d[i].Quantity+"</td><td>"+data.d[i].VehicleNumber+"</td><td> " + data.d[i].ItemStatus +"</td><td>"+ data.d[i].Remarks+"</td><td><a href='javascript:updateItem(req[i], desc[i], veh[i] );'>Process</a> </td></tr>");
}
},
error: function (result) {
},
});
....