javascript - Is it possible to manipulate the target window of a form using Jquery -


i got question regarding forms target , target window.. lets have html.beginform

@using (html.beginform("testhtmlredirect", "home", formmethod.post, new {@target="_blank", @id = "tagging_frm", @class = "form-horizontal row-border" })) {     <input type="submit" value="html psbk click" /> } 

normally upon clicking submit button trigger new tab, question how, or possible append newly created tab of form?

for example want append loading gif on newly created tab parent tab.

assuming actions , scripts same server/origin, can this:

$(function() {   $("#tagging_frm").on("submit",function(e) {     e.preventdefault(); // cancel submit     var w=window.open("",this.target);     w.document.write('<div id="container"><img src="loading.gif"/></div>');     w.document.close();     $.post(this.action,function(data) {       w.document.getelementbyid("container").innerhtml=data;     });   }); }); 

to load csv or pdf try alternative

$(function() {   $("#tagging_frm").on("submit",function(e) {     e.preventdefault(); // cancel submit     var w=window.open("",this.target);     w.document.write('<form id="myform" action="'+this.action+'" target="myframe" method="post"></form><img id="loading" src="loading.gif"/><iframe name="myframe" onload="document.getelementbyid(\'loading\').style.display=\'none\'"></iframe>');     w.document.close();     w.document.getelementbyid("myform").submit();   }); }); 

Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -