jquery - Appending an Array and String in javascript into a variable -


how can run getelementbyid on array , string in javascript , set variable not null example foo["dog"] x = getelementbyid(foo[0]+"food") , x = dogfood

<script>   var myrows = new array();       $(function() {     $("#check").click(function(){       myrows=[]       $(".head input:checked").not("#selectall").each(function(){         myrows.push($(this).parent().attr("id"));       }).value;        alert(myrows);     });         $("#subbut").click(function(){       var x;       var r=confirm("are sure you?");        if (r==true){         x="you pressed ok!";       }else{         object.cancel;       }        **alert( myrows[0]+"servername" + " before" );        for(var =0; i< myrows.length; i++){         alert(myrows[i] +"rootname" +" in loop" );         var j= document.getelementbyid(xmyrows[i] +"rootname" );         alert(j+" after call" );         var y = document.getelementbyid(myrows[i]+"servername");          document.getelementbyid("id_rootname").value= j.textcontent;         document.getelementbyid("id_servername").value= y.textcontent ;**          $.post($("#forms").attr("action"), $("#forms").serialize(), function(data) {          });       }     });   });  </script> 

i don't understand array/string problem is, comments seems you're looking way dynamic form submission: dan davis has provided nuts , bolts of solution in comment — each form need submit dynamically (without refresh), create iframe, set respective form's target attribute iframe's id:

<form id="form1" target="#form1response">     ... </form> <form id="form2" target="#form2response">     ... </form> <iframe id="#form1response"></iframe> <iframe id="#form2response"></iframe> 

you need attach server response callbacks various iframes' load events. beware though: empty iframe fires load event, need filter false positives (empty iframe contents) in callback.

another caveat: if server responds json, ie prompt user save response filesystem before script can intercept — make sure mime type heading set text/plain or text/html make sure response loaded iframe's dom.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -