Invalid JSON primitive ERROR

后端 未结 3 1682
一向
一向 2020-12-29 19:50

Please Help. In my ajax call getting error Invalid JSON primitive, whats wrong with this following ajax call

    $.ajax({
                url: \"/Precedent/         


        
3条回答
  •  南方客
    南方客 (楼主)
    2020-12-29 20:36

    You are promising a content type of application/json but are sending a plain JS Object, which gets serialised as percentile-encoded-string by jQuery. This serialization might be far from valid JSON.

    Change:

    data: {'partyId':party,'PartySelCombo':valueFrom,'DocumentId':DocId},
    

    to:

    data: JSON.stringify({'partyId':party,'PartySelCombo':valueFrom,'DocumentId':DocId}),
    

提交回复
热议问题