When working with a back-end in C# .Net and a client in JavaScript, I am encountering an issue. I make an ajax call to the back-end and receive an object containing members. While debugging on the back-end, I can see the required member when sending the response. However, on the ajax callback, this member is missing!
What could possibly be causing this problem?
Here is a snippet from the Survey class:
[Serializable]
public abstract partial class Survey : BaseClass, IInterface1, IInterface1
{
[JsonIgnore]
public List<Rule> Rules
{
get { return m_rules; }
set
{
m_rules = value;
if (m_rules != null)
{
foreach (SurveyRule rule in m_rules)
{
rule.EnclosingEntity = this;
}
}
}
}
}
Back-end code - while debugging, "Rules" member is visible on the survey object:
return Request.CreateResponse(HttpStatusCode.OK, survey);
Client-side code:
_api.myAjaxCall(par1, par2, function (survey) {
if (callBack) // The Rules member is missing on the survey object! However, everything else is intact.
callBack(data);
});