There is already a function with this function on the Internet, which is implemented in pure JS. However, I found in the project that this function is not compatible with Firefox, so I rewrote this method.
/** * JQUERY implementation of opening a new window in POST form @param:url The URL that needs to be opened @param:args The parameters of the URL, the data type is object @param:name Open the URL window name, if the same button needs to open a new window repeatedly, instead of refreshing the window that is opened for the first time, this parameter should be different each time @param:windowParam Parameter configuration of the newly opened window * @author: haijiang.mo */ function jQueryOpenPostWindow(url,args,name,windowParam){
// Create a form object var _form = $("",{ 'id':'tempForm', 'method':'post', ' action':url, 'target':name, 'style':'display:none' }).appendTo($("body"));
// Add hidden fields to the form for(var i in args){ _form.append($("",{'type':'hidden','name':i,'value' :args[i]})); }
//Clone window parameter object var windowConfig = clone(windowDefaultConfig);
//Configuration window for (var i in windowParam){ windowConfig[i] = windowParam[i]; }
//Window configuration string var windowConfigStr = "";
for(var i in windowConfig){ windowConfigStr = i "=" windowConfig[i] ","; }
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn