English 中文(简体)
j Query JSon没有教区
原标题:jQuery JSon is not parsed
  • 时间:2011-08-09 10:20:18
  •  标签:
  • jquery
  • json

我正试图教化所收到的个人目标,但obj永远无效,obj.d未定义。 问题在哪里?

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: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    var obj = $.parseJSON(data);
                    console.log(obj.d);                    
                },
                error: ""
            });
问题回答

如果您的数据,则无需<代码>。 类型<编码>json。

<代码>数据为javascript 反对本身。





相关问题
JQuery/MVC Search Issue

I have inherited a piece of work where the entry screen shows a summary of 20 calculated variables. E.g. Var A (250), Var B (79). Clicking on any of these links takes the user to a view with a ...

jQuery quicksearch plug-in tinkering with JSON

I ve implemented the quicksearch plugin by Rik Lomas and I love it for an application in a custom CMS I m building. I was wondering though, since I m going to have a bizillion items in the table if ...

JSON with classes?

Is there a standardized way to store classes in JSON, and then converting them back into classes again from a string? For example, I might have an array of objects of type Questions. I d like to ...

PHP json_decode question

i m trying to use json_decode to combine a few json objects and then re-encode it. my json looks like: { "core": { "segment": [ { "id": 7, "...

Converting JSON data to Java object

I want to be able to access properties from a JSON string within my Java action method. The string is available by simply saying myJsonString = object.getJson(). Below is an example of what the string ...

热门标签