如何使用2 href将数据从一个php文件发送到另一个php文件?
我想将数据发送到其他php文件 我可以用这个url代码将数据发送到我的第二个php文件如何使用2 href将数据从一个php文件发送到另一个php文件?,php,Php,我想将数据发送到其他php文件 我可以用这个url代码将数据发送到我的第二个php文件 www.test.com/second.php?task=demo&id=55 我有一个像这样的href代码 <a href="first.php?task=first&name=Jack">send</a> <a href="first.php?task=first&name=Jack and second.php?task=demo&id=
www.test.com/second.php?task=demo&id=55
我有一个像这样的href代码
<a href="first.php?task=first&name=Jack">send</a>
<a href="first.php?task=first&name=Jack and second.php?task=demo&id=55">send</a>
<a class="sender" href="#" data-task="first" data-name="Jack"
data-task2="demo" id="55">send</a>
jQuery(document).ready( function() {
$(document.body).on('click',".sender", function(e){
var id = $(this).attr("id");
var task = $(this).attr("data-task");
var name = $(this).attr("data-name");
var task2 = $(this).attr("data-task2");
jQuery.ajax({
url: ajax_url + '[INCLUDE PATH HERE]first.php',
type: 'POST',
async: false,
cache: false,
data: {"task":task, "name": name },
success: function (response) {
[output data if necessary]
}
});
jQuery.ajax({
url: ajax_url + '[INCLUDE PATH HERE]second.php',
type: 'POST',
async: false,
cache: false,
data: {"task":task2, "id": id },
success: function (response) {
[output data if necessary]
}
});
});
});
你想做这样的事 像这样构造你的锚
<a href="first.php?task=first&name=Jack">send</a>
<a href="first.php?task=first&name=Jack and second.php?task=demo&id=55">send</a>
<a class="sender" href="#" data-task="first" data-name="Jack"
data-task2="demo" id="55">send</a>
jQuery(document).ready( function() {
$(document.body).on('click',".sender", function(e){
var id = $(this).attr("id");
var task = $(this).attr("data-task");
var name = $(this).attr("data-name");
var task2 = $(this).attr("data-task2");
jQuery.ajax({
url: ajax_url + '[INCLUDE PATH HERE]first.php',
type: 'POST',
async: false,
cache: false,
data: {"task":task, "name": name },
success: function (response) {
[output data if necessary]
}
});
jQuery.ajax({
url: ajax_url + '[INCLUDE PATH HERE]second.php',
type: 'POST',
async: false,
cache: false,
data: {"task":task2, "id": id },
success: function (response) {
[output data if necessary]
}
});
});
});
看一看请求上的闪烁数据,这将更有益。但你的目标是标题定位:你的url;您的问题不是很清楚。我已经编辑了我的postmaybe,是否使用ajax将这两个请求发送到php?这个问题不是很清楚,我怎样才能用ajax做到这一点?你能帮助我吗。我知道这个问题不是很清楚,我的英语不好。XMLRPC?在客户端标签中?你在说什么?