query

performs an async or sync ajax request

void query(string method,string url,string data,boolean async, [function callback,object headers] );

Parameters

methodstringthe method used for sending request, "GET" by default
urlstringurl to the server side
datastringthe data sent to the server side by the POST-request
asyncbooleanthe mode of sending data to a server, true by default
callbackfunctionoptional, a function to call after the response is loaded
headersobjectoptional, a set of headers, defined as "key":"value" pairs that should be sent with a request

Example

dhx.ajax.query({
    method:"POST",
    url:"some.php",
    data:"k1=v1&k2=v2",
    async:true,
    callback:function(){},
    headers:{
        "MyHeader-Name1":"value1",
        "MyHeader-Name2":"value2",
    }
});

Details

the headers param allows specifying additional Request Headers. This API can be used in quite specific cases, e.g. for loading data from third party API and data services.

Change log

added in version 4.1.2

Back to top