I am working ajax,when I Ajax call, the Ajax continues to not work. It goes straight to error: and I get Object Object.
Loading
I am working ajax,when I Ajax call, the Ajax continues to not work. It goes straight to error: and I get Object Object.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Garima BansalRank #1,554 · 1K reputationPosted Oct 31, 2023, 7:53 AM EDT
function createLinedeptpending(applno) { alert(applno); $Jbdtp.ajax({ url: '@Url.Action("getLineDeptPending", "Reports")', type: "GET", contentType: "application/json; charset=utf-8", dataType: "json", data: { appcode: applno }, success: function (data) { var sno = 1; var html = ''; //debugger; alert("ss"); $Jbdtp.each(data, function (key, item) { var converteddat = getDateIfDate(item.updateddt); html += ''; html += '' + sno + ''; html += '' + item.proposalname + ''; if (item.remarks == null ) { html += '' + "" + ''; } else { html += '' + item.remarks + ''; } if (converteddat == false) { html += '' + "" + ''; } else { html += '' + converteddat + ''; } if (item.Mstatus == "APR") { html += '' + "Approved" + ''; } else if (item.Mstatus == null) { html += '' + "Pending" + ''; } else { html += '' + "Rejected" + ''; } if (item.Muploaddoc == null) { html += '' + "" + ''; } else { html += '' + "Download" + ''; } html += ''; sno++; }); $Jbdtp('.tbodycy').html(html); }, error: function (XMLHttpRequest, textStatus, errorThrown) { alert("errror"); alert("Error Thrown: " + errorThrown); alert("Text Status: " + textStatus); alert("XMLHttpRequest: " + XMLHttpRequest); alert((XMLHttpRequest.responseText).error); } }); $Jbdtp("#statusModal").modal('show'); }Jignesh KumarRank #91 · 22.9K reputationPosted Oct 31, 2023, 8:39 AM EDT
Hi Garima,
Please put debugger in getLineDeptPending() in your ReportsController and check return type of getLineDeptPending method which take appCode as parameter(check your parameter datatype it should be same in method parameter passed from Ajax method). It should return json object. Check below code when this code run it shout hit debugger in getLineDeptPending method
function createLinedeptpending(applno) { alert(applno); $Jbdtp.ajax({ url: '@Url.Action("getLineDeptPending", "Reports")', type: "GET", contentType: "application/json; charset=utf-8", dataType: "json", data: { appcode: applno }, success: function (respnse) { alert(respnse.data); }, error: function (XMLHttpRequest, textStatus, errorThrown) { alert("errror"); alert("Error Thrown: " + errorThrown); alert("Text Status: " + textStatus); alert("XMLHttpRequest: " + XMLHttpRequest); alert((XMLHttpRequest.responseText).error); } }); }