Invalid JSON primitive ERROR

后端 未结 3 1681
一向
一向 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

    Try with, remove " ' " from data,

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

    Use single quote to assign your values like

    Wrong:

    $.ajax({
      type: 'POST',
      contentType: 'application/json',
      dataType: 'json',
      url: 'WebService.asmx/Hello',
      data: { FirstName: "Dave", LastName: "Ward" }
    });
    

    Right:

    $.ajax({
      type: 'POST',
      contentType: 'application/json',
      dataType: 'json',
      url: 'WebService.asmx/Hello',
      data: '{ FirstName: "Dave", LastName: "Ward" }'
    });
    

    Please follow below link for clarifications

    Invalid Json Premitive Possible Reason

提交回复
热议问题