1. 程式人生 > >Failed to load resource: the server responded with a status of 500 (Internal Server Error)

Failed to load resource: the server responded with a status of 500 (Internal Server Error)

【原因】

因為這個表和另一個表是有一對多關係的,當序列化表1的時候,會找到和另一個表2關聯的欄位,就會到另一個表2中序列化,然後另一個表2中也有一個欄位和表1相關聯.這樣.序列化就會發生這種錯誤!

【解決方案】

/注:這裡值得注意的是,當有外來鍵向關聯時,必須要指定序列化元素,如果沒有外來鍵相關聯,直接序列化該實體物件
return Json(new { ti.TypeName,ti.Typevalue,ti.UserId,ti.Remark,ti.FullPath,ti.TyId,ti.isdisplay}, JsonRequestBehavior.AllowGet);