jquery设置要提交的url

jquery设置要提交的url,jquery,jquery-ui,Jquery,Jquery Ui,我有一张有这个验证的表格 jquery 如果没有错误,我想在提交之前将url设置为submit,我的意思是在语句之前 $(this)[0].submit(); 您需要使用: $(this).submit(); 编辑:(在OP评论之后) 如果您想使用javascript中的某些特定值提交表单: 在表单中添加两个字段,如下所示: <input type='hidden' name='currentRelation' id='currentRelation'> <input ty

我有一张有这个验证的表格

jquery 如果没有错误,我想在提交之前将url设置为submit,我的意思是在语句之前

$(this)[0].submit();
您需要使用:

$(this).submit();
编辑:(在OP评论之后)

如果您想使用javascript中的某些特定值提交表单:

在表单中添加两个字段,如下所示:

<input type='hidden' name='currentRelation' id='currentRelation'>
<input type='hidden' name='currentConcept' id='currentConcept'>
现在在服务器端:

print_r( $_POST ); 
// OR 
print_r( $_GET );

@LinCR
action
是提交表单的
form
属性OK我找到你了,所以即使我把它放在我的html代码中
hi再次,我测试了[0]并且它工作了,我想把currentConcept和currentRelation放在url:)请查看编辑过的答案。希望这次能有所帮助:)你的代码运行得很好,但有一件事,请检查我的jquery代码,currentConcept和currentRelation在一个循环中,所以我猜不出我需要进行多少隐藏输入,在这种情况下,名称应该是currentConcpet[],currentRelation[],因为我必须发送一个动态生成的数组,非常感谢我解决了它`var currentconcepts=new Array()$(“.ioAddConcept”).each(函数(索引){currentconcepts[index]=$(this.html();});var currentrelations=新数组()$(“.ioAddRelation”).each(函数(索引){currentrelations[index]=$(this.html();})//$(此[0]。提交();//如果没有错误$(this.attr('action',').submit(),则提交表单`
<input type='hidden' name='currentRelation' id='currentRelation'>
<input type='hidden' name='currentConcept' id='currentConcept'>
// Get values from HTML (According to your previous question)
var ioAddConcept = $(".ioAddConcept").html();
var ioAddRelation = $(".ioAddRelation").html();

// Set these values to hidden fields
$('#ioAddConcept').text( ioAddConcept );
$('#ioAddRelation').text( ioAddRelation );

// Now submit form
$(this).submit();
print_r( $_POST ); 
// OR 
print_r( $_GET );