开发者

jQuery JSon is not parsed

I am trying to parse received JSON object but obj is always null and obj.d is undefined. Where is the problem?

JSon response

{"d":"psize=a4&porient=portrait&margintop=10&marginleft=5&marginright=5&marginbottom=10&title=&author=&subject=&keywords=&userpass=&ownerpass=&coverpage=http%3A%2F%2F&conversiondelay=1&allowscript=true"}

The code which call server and receive response above from server

 $.ajax({
                type: "POST",
                url: "Default.aspx/LoadOptions",
                data: "",
                contentType: "ap开发者_Go百科plication/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    var obj = $.parseJSON(data);
                    console.log(obj.d);                    
                },
                error: ""
            });


You don't need $.parseJSON if your dataType is json.

data is the javascript object itself.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜