Getting the error: JavaScript runtime error: Circular reference in value argument not supported

asp.net-mvc entity-framework-6 javascript jquery wcf

Question

When trying to edit and save a record in an ajax call via javascript, I am getting the above subject error.

I did some looking up, and the only thing I can find was something about a "compareByIdentity" property which I couldn't get how to implement in my situation, if that's the case.

The below class is where there is a one to many relationship. There can be one "project" to many "timetrackings". This is the class for the "TimeTrackings" where the "ProjectID" is the foreign key.

I am using a WCF application to retrieve and edit the data with EF 6. This is the first time I'm encountering it in my application. Obviously, because of the way the relationship is set up.

Can someone please inform me how I can correct this error?

namespace YeagerTechDB.Models
{
    using System;
    using System.ComponentModel.DataAnnotations;
    using System.Runtime.Serialization;

    [Serializable, DataContract(IsReference = true)]
    public partial class TimeTracking
    {
        [Key]
        [ScaffoldColumn(false)]
        [Editable(false)]
        [Display(Name = "Tracking ID")]
        [DataMember]
        public int TimeTrackingID { get; set; }

        [Required]
        [Display(Name = "Project ID")]
        [DataMember]
        public short ProjectID { get; set; }

        [Required]
        [DataType(DataType.Date)]
        [DataMember]

        public DateTime StartDate { get; set; }

        [Required]
        [DataType(DataType.Date)]
        [DataMember]

        public DateTime EndDate { get; set; }

        [DataType(DataType.MultilineText)]
        [DataMember]
        public string Notes { get; set; }

        [DataType(DataType.DateTime)]
        [DataMember]
        public DateTime CreatedDate { get; set; }

        [DataType(DataType.DateTime)]
        [DataMember]
        public DateTime? UpdatedDate { get; set; }

        [DataMember]
        public virtual Project Project { get; set; }
    }
}

The output of the debugging is below. Please copy the image and paste it to your favorite image viewer for better detail.

Notice that the value of the TimeTrackingID is set correctly to 1. enter image description here

1
3
2/16/2015 4:23:06 PM

Accepted Answer

The problem is coming from your JSON.stringify in line 66.

You are converting the object Tracking_Input to json. Tracking_Input.TimeTrackingID is a jquery array of dom elements with the id TimeTrackingID, and this cannot be converted to json.

Did you mean $('TimeTrackingID').val() to match the other lines

6
2/16/2015 4:28:42 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow