const formulaData = $(htmlContainer).find("ins").map(function (i, el) {
return {
fName: $(el).attr("data-record-name"),
fID: $(el).attr("data-record-id"),
fContent: $(el).text()
}
});
//keep
if (formulaData /*&& selFormInner.length*/) {
// Get formula HTML from server
$.postJSON(formulaUrl, {
formula: formulaData
};
This portion of my JavaScript code requests the execution of a server-side method using $.postJSON. The issue I'm facing is with the error "Converting circular structure to JSON" which occurs on the line 'data': JSON.stringify(data) in the postJSON script file.
My question pertains to this circular structure error. While I have seen examples where an object references itself causing this issue, I'm unsure why it applies to my variable selectFormula defined at the beginning. What makes this structure circular? Despite attempting various solutions as evident from my commented-out code, I still struggle to resolve the error.
The JSON data being sent to the server mirrors a struct generated in C#, but since the problem arises client-side and doesn't reach the server-side method, the focus remains on fixing the issue within the client's environment. Any insights or advice would be greatly appreciated.
Thank you for your assistance in advance.