Making getAsync request in Javascript for Windows Phone

I am trying to make a request to a backend API I created on Google App Engine. Right now it should be pretty simple, it sends the URL, and what should be returned is JSON that looks like this {"keys": [5676073085829120]}. I have tested the API by making CURL requests, and the the URL works, one thing that confuses me is that when I make a CURL request I have to specify "Accept: application/json", but I do not know how to add that to a getAsync request. Here is the code in question:

function verify(){
    var uname = document.getElementById("username").value;
    var pword = document.getElementById("password").value;

    var c = new Windows.Web.Http.HttpClient();
    var complete = "" + uname + "/" + pword;

    c.getAsync(new Windows.Foundation.Uri(complete)).done(function (result) {
    var jsonResult = JSON.parse(result.content.toString());
    var key = jsonResult.Results.series[0].data;
    console.log("in here");
    var authKey = new Array();
    key.forEach(function (cur, i, arr) {

I tried stepping through the code with the debugger in visual studio. It initializes the variables, and the value of my 'complete' variable is the correct URL that I have used for my cURL requests. I set a breakpoint inside of the function that is supposed to happen once the request completes, but the code never makes it inside of that function and eventually the windows phone emulator goes black and it seems like it just hangs, it doesn't exit but it gets to a point where I can no longer step through. I have been trying and trying but I just can't figure it out, and to make it worse the documentation for all of this stuff is garbage. Any help would be very greatly appreciated. Thanks in advance.


That need to be specified in the content of a request. To specify the content type of a request, you need to use HttpRequestMessage to create request and then specify the media type. You then need to use sendRequestAsync method of HttpClient to process your request. So your code will be something similar to the following.

var hc = new Windows.Web.Http.HttpClient();
var uri = new Windows.Foundation.Uri("" + uname + "/" + pword);
var request = new Windows.Web.Http.HttpRequestMessage(Windows.Web.Http.HttpMethod.get, uri);
var content = "";
var encoding = Windows.Storage.Streams.UnicodeEncoding.utf8;
var mediaType = "application/json";
request.content = new Windows.Web.Http.HttpStringContent(content, encoding, mediaType);

Need Your Help