首页IT科技MVC3, jQuery and JSON.stringify

MVC3, jQuery and JSON.stringify

时间2025-06-18 07:37:49分类IT科技浏览5044
导读:MVC3, jQuery and JSON.stringify...

MVC3, jQuery and JSON.stringify

RSS

‹ Previous Thread|Next Thread ›
Reply

atnoslen

Member

7 Points

13 Posts

MVC3, jQuery and JSON.stringify

Feb 06, 2012 05:45 PM|LINK

I ran into an issue with JSON.stringify() when trying to use $.getJSON(). Examine this stack overflow discussion,http://stackoverflow.com/questions/9162359/mvc3-controller-null-parameter-using-json-stringify/9164417#9164417

Breakdown,

When using $.getJSON() or any $.ajax call with a GET request and using JSON.stringify(), the parameters are null. This works fine with a HTTP POST, but not with a GET. Notice where

$.getJSON(/, JSON.stringify({id:"test"}));

will result inGEThttp://localhost?{%22id%22:%22test%22} HTTP/1.1

while

$.getJSON(/,{id:"test"});

results inGEThttp://localhost/?id=testHTTP/1.1

Note that the following DOES work.

$.getJSON(/,{"id":"test"});

To drive the topic home, this DOES NOT work.

$.getJSON(/,{ "id": "test" });

I have resorted to using POST to make ajax json calls. If this is not the proper place to submit bugs or discussion, my apologies.

Noslen

声明:本站所有文章              ,如无特殊说明或标注                    ,均为本站原创发布             。任何个人或组织       ,在未征得本站同意时              ,禁止复制             、盗用                     、采集       、发布本站内容到任何网站      、书籍等各类媒体平台                     。如若本站内容侵犯了原著者的合法权益                    ,可联系我们进行处理       。

创心域SEO版权声明:以上内容作者已申请原创保护,未经允许不得转载,侵权必究!授权事宜、对本内容有异议或投诉,敬请联系网站管理员,我们将尽快回复您,谢谢合作!

展开全文READ MORE
手表维修价目表图片及价格(手表维修_机械表维修_手表维修网) mac电脑系统安装(苹果mac操作系统安装图文教程(比较详细))