无效的JSON原始错误 [英] Invalid JSON primitive ERROR

查看:310
本文介绍了无效的JSON原始错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助。在我的ajax调用收到错误无效的JSON原始的,什么是错这个下面Ajax调用

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

    $.ajax({
                url: "/Precedent/ShowPartyContents", type: "POST",
                contentType: 'application/json; charset=utf-8',
                dataType: 'html',
                data:{'partyId':party,'PartySelCombo':valueFrom,'DocumentId':DocId},
                sucess:function(result){
                    alert("String"+ result);
                    //jq("#PartyTagContentArea-"+ pass cheyyenda id).html(data).fadeIn();
                },
                error : function( ts ){ 
                    alert("error :(" + ts.responseText);


                }

            });

感谢

推荐答案

您是有希望的应用程序/ JSON 的内容类型,但是发送的是纯JS对象,它得到序列化为百分恩codeD-字符串的jQuery。这种序列化可能是远离有效的JSON。

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.

修改

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

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

这篇关于无效的JSON原始错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆