有没有办法将表单发布到更多 URL?
我需要它在 javascript 中..
例如:我有 2 个文档:1.php 和 2.php.. 我希望表单将数据发布到这两个文件,但是转到 1.php..
你知道什么方法吗?
最佳答案
您需要一个带有操作“1.php”和 jQuery 的表单。
$('#form_id').submit(function(event){
event.preventDefault();
var $th = $(this);
$.ajax({
type: 'post',
url: '2.php', // note: edited by Ryan
data: $th.serialize(),
success: function(){
$th.submit();
}
});
});
关于php - 将表单发布到更多 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8024490/