Why is this call showing the values encoded onto the URL like so?
http://localhost:49597/api/auth?user=jon&password=123
Am using the following ajax call…
$.ajax({ url: "api/auth",
type: "get",
data: { user: "jon", password: "123" },
dataType: "json",
contentType: "application/json; charset=utf-8"
});
I want the data to be sent as json…
Because it is a GET request.
GETwill send data in the querystring. If you want to avoid that, you can change your type to POST POST will send the data in the request body.If it is a Login form, you should probably use
POSTmethod.