隐藏表单提交在Ios中不起作用

时间:2018-04-19 09:55:35

标签: javascript form-submit

您好我正在使用javascript,html,css开发应用程序。它将作为应用程序和Web应用程序运行。我正在创建一个隐藏的表单提交,如下所示。

hiddenFormSubmit:function(path, params, method) {    
    var form;
    form = document.forms.namedItem('myForm');
    if(form === null){
        method = method || 'post'; 
        form = document.createElement('form');
        form.setAttribute('name', 'servicesForm');
        form.setAttribute('method', method);
        form.setAttribute('action', path);
        form.setAttribute('target', 'report');
        document.body.appendChild(form);
    }
    else{
        form.innerHTML = '';
    }
    for(var key in params) {
        if(params.hasOwnProperty(key)) {
            var hiddenField = document.createElement('input');
            hiddenField.setAttribute('type', 'hidden');
            hiddenField.setAttribute('name', params[key].id);
            hiddenField.setAttribute('value', params[key].value);
            form.appendChild(hiddenField);
         }
    }


        window.open('','report');

    form.submit();
    },

这个在桌面浏览器和移动浏览器中完美运行。但不适用于iOs app.In桌面浏览器和移动浏览器正在按预期打开一个新窗口。但在iOs应用程序中,它打开了一个有一些错误的新窗口。我是否需要添加任何内容才能在iOs app中工作。请建议。

0 个答案:

没有答案