Share ideas, ask questions, and get feedback about developing for ProcessMaker
Forum rules: Please post new questions under "Developing processes & programming" for ProcessMaker 2 or 3.
#784739
I write this function for ajax
Code: Select all
function ajax(url, callback, error, method, cache, async) {
    async = async || true;
    //alert(cache);
    if (typeof(cache) == 'undefined') {
        cache = false;
    }
    if (typeof(method) == 'undefined') {
        method = 'GET';
    }
    if (window.XMLHttpRequest) // code for IE7+, Firefox, Chrome, Opera, Safari
    {
        xmlhttp = new XMLHttpRequest();
    } else // code for IE5, IE6
    {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }

    xmlhttp.onreadystatechange = function() {

        if (xmlhttp.readyState == 4) {
            if (xmlhttp.status == 200) {
                if (typeof(callback) == 'function') {
                    callback(xmlhttp.responseText);
                }

            } else {

                if (typeof(error) == 'function') {
                    error(xmlhttp.status);
                } else {
                    alert('خطا : لطفا مجددا تلاش کنید.');
                }


            }


        }

    }
    var d = new Date();
    var n = d.getTime();
    var getExplode = url.split("?");
    scriptName = url;
    param = '';
    if (getExplode.length > 1) {
        scriptName = getExplode[0];
        param = getExplode[1];
        if (cache == false) {
            param = param + "&n=" + n;
        }

    } else {
        if (cache == false) {
            param = param + "n=" + n;
        }
    }

    if (method.toLowerCase() == 'post') {
        xmlhttp.open("POST", scriptName, async);
        xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        xmlhttp.send(param);

    } else {
        xmlhttp.open("GET", scriptName + '?' + param, async);
        xmlhttp.send();
    }



}
for example
Code: Select all
     var url = ajaxUrl + "OperationRenovation.php?Command=GetDetail&IdDarkhast=" + ID + "&Code=" + Code + "&Mabna=" + Mabna;
     ajax(url, function(Response) {}, function() {
         alert('مشکل در برقراری ارتباط با سرور');
     }, 'post');

Web3 development encompasses creating decentralize[…]

The Upland Clone Script, offered by Dappsfirm, rep[…]

Dappsfirm offers a bet365 clone script that mirror[…]

🚀 Tauchen Sie mit Immediate Alora AI in die Welt d[…]