1. 程式人生 > >js post 傳遞引數

js post 傳遞引數

function spanedit(id)
{
        event.stopPropagation();
        var params = new Array();
        params['id'] = 'id';
        //params.push({ name: "id", value: id});
        var temp = document.createElement("form"); 
        temp.action = "/epmaster/deansystem/organization/organization_edit"; 
        temp.method = "post"; 
        temp.style.display = "none"; 
        for (var x in params)
        {
            var opt = document.createElement("input"); 
            opt.name = x; 
            opt.value = params[x];
            temp.appendChild(opt); 
        }
        document.body.appendChild(temp); 
        temp.submit(); return temp;
}