jQuery return parameters
This could be a novice question, but here goes开发者_JS百科...
Why do we use data**.d** when we have to read data from a jquery to web-service call? What is the significance of the .d?
Is there any supporting documentation for the same?
Updated : comments in bold
Thanks,
Sashidhar Kokku
The ".d" is a security feature that Microsoft (and other venders) added in ASP.NET 3.5’s version of ASP.NET AJAX (and other frameworks). By encapsulating the JSON response within a parent object, the framework helps protect against a "JSON hacking" XSS vulnerability.
http://haacked.com/archive/2009/06/25/json-hijacking.aspx
From the article:
ASP.NET and WCF JSON service endpoints actually wrap their JSON in an object with the “d” property as I wrote about a while back. While it might seem odd to have to go through this property to get access to your data, this awkwardness is eased by the fact that the generated client proxies for these services strip the “d” property so the end-user doesn’t need to know it was ever there.
With ASP.NET MVC (and other similar frameworks), a significant number of developers are not using client generated proxies (we don’t have them) but instead using jQuery and other such libraries to call into these methods, making the “d” fix kind of awkward.
精彩评论