Pass Parameters To XMLHttpRequest Object
<p>How can I pass parameters to the XMLHttpRequest Object? </p>

<pre><code>function setGUID(aGUID) {

    var xhReq = new XMLHttpRequest();

    xhReq.open("POST", "ClientService.svc/REST/SetAGUID" , false);
    xhReq.send(null);
    var serverResponse = JSON.parse(xhReq.responseText);
    alert(serverResponse);
    return serverResponse;
}
</code></pre>

<p>I need to use javascript instead of jquery, in jquery I got it to work with this code, but cant seem to figure it out the straight javascript way..</p>

<pre><code>function setGUID(aGUID) {

    var applicationData = null;

    $.ajax({
        type: "POST",
        url: "ClientService.svc/REST/SetAGUID",
        contentType: "application/json; charset=utf-8",
        data: JSON.stringify({ aGUID: aGUID }),
        dataType: "json",
        async: false,
        success: function (msg) {

            applicationData = msg;

        },
        error: function (xhr, status, error) { ); }
    });

    return applicationData;

}
</code></pre>
