jquery form表單

/**
 * 使用方法:postForm('url', {key1: value1, key2: value2});
 * @param URL
 * @param PARAMS
 * @returns {___anonymous1457_1460}
 */
function postForm(URL, PARAMS , type) {
    var temp = document.createElement("form");
    temp.action = URL;
    temp.method = type | "post";
    temp.style.display = "none";
    for (var x in PARAMS) {
        var opt = document.createElement("textarea");
        opt.name = x;
        opt.value = PARAMS[x];
        temp.appendChild(opt);
    }
    document.body.appendChild(temp);
    temp.submit();
    return temp;
}
相關文章
相關標籤/搜索