﻿var handleSuccess = function(o) {
    if (o.responseText !== undefined) {
        div.innerHTML = o.responseText;
    }
}
var handleFailure = function(o) {
    if (o.responseText !== undefined) {

        div.innerHTML = "<li>Transaction id: " + o.tId + "</li>";
        //div.innerHTML += "<li>HTTP status: " + o.status + "</li>";
        div.innerHTML += "<li>Status code message: " + o.statusText + "</li>";
        div.innerHTML += "<p><b>Fehler beim Request. Bitte versuchen Sie es erneut. sollte das Problem weiterhin bestehen, melden Sie sich bitte bei uns.</b></p>";

    }
}
var callback =
{
    success: handleSuccess,
    failure: handleFailure,
    timeout: 8000,
    argument: { foo: "foo", bar: "bar" }
};

function getResult() {
    //var rand_no = Math.random();
    //rand_no = rand_no * 100;
    //sUrl_rand = sUrl + "?" + rand_no;
    var fullURL = parent.document.URL;
    var keepAttributes = fullURL.substring(fullURL.indexOf('?'), fullURL.length)
    if (fullURL.indexOf('?') > 0) {
        sUrl = sUrl + keepAttributes;
    }
    var request = YAHOO.util.Connect.asyncRequest('GET', sUrl, callback);
}