﻿// Call a remote web page using standard http-get protocol
function AskRemote(url,onSuccessMethod, onFailureMethod ,param)
{
    new Ajax.Request(url,
    {
            method:'get',     
        onSuccess: function(transport){
            var response = transport.responseText || "no response text";
            onSuccessMethod(response,param);
        },     
        onFailure: function(err){
             onFailureMethod(err); 
        }
    }); 
}
function AskRemoteSynchro(url,onSuccessMethod, onFailureMethod ,param)
{
    new Ajax.Request(url,
    {
            method:'get', 
            asynchronous: false,    
        onSuccess: function(transport){
            var response = transport.responseText || "no response text";
            onSuccessMethod(response,param);
        },     
        onFailure: function(err){
             onFailureMethod(err); 
        }
    }); 
}

function AskRemoteSynchroPost(url, postBody, onSuccessMethod, onFailureMethod, param) {
    new Ajax.Request(url,
    {
        method: 'post',
        postBody: postBody,
        asynchronous: false,
        onSuccess: function(transport) {
            var response = transport.responseText || "no response text";
            onSuccessMethod(response, param);
        },
        onFailure: function(err) {
            onFailureMethod(err);
        }
    });
}




