Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Json data has {d:"data"}

I am writing jquery ajax code to call wcf service.

In this case WCf returns html as string.

Some how when data is back in jquery it is in {d:"data"} format, What is this d element?

below is code

$.get('<%= ResolveClientUrl("~/AjaxServices/ListingBrowse.svc/GetNewsHTML")  %> ',
  null,
  function(data) {
    alert(data);
    $('#newsdiv').html(data.d);
  },
  "html");
like image 446
mamu Avatar asked Feb 10 '26 21:02

mamu


1 Answers

The extra "d" parameter is added by the .NET framework as an added security measure against XSS attacks (source). It's included when the "Content-Type" of the request specifies "application/json".

like image 54
Crescent Fresh Avatar answered Feb 13 '26 13:02

Crescent Fresh