Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/427.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用jquery重定向页面_Php_Javascript_Jquery - Fatal编程技术网

Php 使用jquery重定向页面

Php 使用jquery重定向页面,php,javascript,jquery,Php,Javascript,Jquery,我有以下html代码: <form method="post" name="b" > <table> <tr> <td>Field A</td> <td><input type='text' name='field[0][a]' id='field[0][a]'></td> <td>Field B</td>

我有以下html代码:

    <form method="post" name="b" >
<table>
    <tr>
        <td>Field A</td>
        <td><input type='text' name='field[0][a]' id='field[0][a]'></td>
        <td>Field B</td>
        <td><textarea name='field[0][b]' id='field[0][b]'></textarea></td>
        <td><button>remove</button></td>
    </tr>
</table>
</div>
<div id="container"></div>
<button id="mybutton">add form</button>

<div align="center">
<p><button onClick="dadosFormularios()" value="Registar" name="registar">Registo</button></p>
</div>
</form>

场A
B区
去除
添加表单
登记处

如您所见,当我单击调用函数“dadosFormularios()”时,有一个按钮

函数dadosFormularios(){ var dadosFormulario={}; var iterador=计数形式; var i=0;
而(i在这里尝试
document.location=您的url;

您不需要jQuery重定向,只需要javascript

window.location.href="page.html";

我想你可能想做这样的事情:

var qstring = '';
var tmp_qstring = [];
for ( var i = 0; i < dadosFormulario.length; i++ )
{
       tmp_qstring[i] = 'a' + i + '=' + dadosFormulario[i]['a'] + '&' + 'b' + i + '=' + dadosFormulario[i]['b'];

}

qstring = tmp_qstring.join('&');

window.location = 'page.php?' + qstring;

我想这就是你的意思……

你似乎在将一个对象作为数组进行迭代……我建议你在中为……使用为对象设计的
。好的,谢谢,我会检查你的建议:Pyes,是这样的,问题是我无法重定向页面,也不知道为什么。我尝试了window.location和其他sugest这里给出的离子无法使其中一个正常工作:/redirection solved:P我将尝试了解您对内容重定向的建议。它是与GET一起使用的?不能与POST一起使用吗?Doug Johnson我猜循环不起作用,当页面重定向时,没有“page.php”出现。我在循环中插入了一个警报,但他没有出现。这是方法length(),它返回“undefined”,它在连接时给了我一个错误。它在控制台上显示:Uncaught TypeError:无法读取undefineddone的属性“a”,这是因为我在错误的位置放置了一个标记,我猜,它现在正在工作重定向,谢谢:P
var qstring = '';
var tmp_qstring = [];
for ( var i = 0; i < dadosFormulario.length; i++ )
{
       tmp_qstring[i] = 'a' + i + '=' + dadosFormulario[i]['a'] + '&' + 'b' + i + '=' + dadosFormulario[i]['b'];

}

qstring = tmp_qstring.join('&');

window.location = 'page.php?' + qstring;
page.php?a1=val&b1=val&a2=val&b2=val...