Hello,
I am trying to call a WCF RESTful service from jQuery. I am using JSON to encode both request and response.
The following code functions correctly in IE8:
url = 'http://ipv4.fiddler:5683/WeatherWCF/NewBinding/MyService/GetValueFloat';
$.ajax({
url: url,
data: '{"alias": "Udetemperatur"}',
type: "POST",
contentType: "application/json; charset=utf-8",
dataType: "text", // not "json" we'll parse
success:
function(res) {
alert('Received response: ' + res);
}
});
However, in both Firefox and Chrome, res contains an empty string. After using Fiddler to monitor the request, it appears that jQuery sends an empty request to the server as shown in this screen dump: http://imgur.com/EJgwS.png
This is the successful request: http://imgur.com/S77BA.png
What am I doing wrong?
Kind regards,
Martin