What is a task?
A task is a html web page and the page can be loaded into a web browser and running some javascript to perform a task. The web browser will be running on server side instead of client side. Any one can send an api request to a task server to request server side running a html web page that hosted any where.




Request a task server to load and run a task page
    //cmd:'task'
    //table: a table that contains the task registration,
    //task_url: the task page url
    //input: json object send to task as input
    $vm.request({cmd:'task',table:'demo-vm-19100901',task_url:"https://projects.vmiis.com/sites/122/task.html",input:{}},function(res){
        console.log(res);
    });




Task javascript
    function run_task(){
        //do something
        //as an example, here we read a number (Result) from a table (demo-vm-19100902), increase 1, then save back.
        $vm.request({cmd:'find',table:'demo-vm-19100902',query:{"Data.Name":"sydney"},sort:{_id:-1},skip:0,limit:1},function(res){
            if(res.result.length>=1){
                var r=res.result[0].Data.Result;
                var n=parseInt(r);
                n++;
                var data={}
                for(a in res.result[0].Data){
                    data[a]=res.result[0].Data[a];
                }
                data.Result=n;
                $vm.request({cmd:'update',id:res.result[0]._id,table:'demo-vm-19100902',data:data,index:{},file:{}},function(res){
                    if(window.close_page!=undefined) window.close_page();
                    //console.log(res);
                })
            }
            else if(window.close_page!=undefined) window.close_page();
        });
    }