最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

jquery - Getting the error: JavaScript runtime error: Circular reference in value argument not supported - Stack Overflow

programmeradmin3浏览0评论

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 "pareByIdentity" 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.

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 "pareByIdentity" 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.

Share Improve this question asked Feb 16, 2015 at 16:23 sagesky36sagesky36 4,69220 gold badges86 silver badges134 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

The problem is ing 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

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论