Javascript 我如何在没有url的情况下使用$.post?

Javascript 我如何在没有url的情况下使用$.post?,javascript,jquery,html,Javascript,Jquery,Html,大家好,我想知道有没有可能这样做? 首先,我使用$.post将数据发布到a href。当发布完成后,它将有数据(这没有href),然后我想发送另一个数据,但我不知道它的href是什么。 例如: $.post("/link", { "action" : "add_points_for_user", "search_user" : "data", "submit_search_user" :"Ok" }, function(z) { console.log(z); //

大家好,我想知道有没有可能这样做? 首先,我使用
$.post
将数据发布到a href。当发布完成后,它将有数据(这没有href),然后我想发送另一个数据,但我不知道它的href是什么。 例如:

$.post("/link", {
   "action" : "add_points_for_user",
   "search_user" : "data",
   "submit_search_user" :"Ok"
}, function(z) {
   console.log(z);
   // I want to send another data on it (use $.post) without using url 
});
不可以。在没有url的情况下发布数据是不可能的。如果你不想把它寄到别的地方,那又有什么意义呢?然后你就可以拥有这个变量,并在任何你想要的地方使用它们,而不是发布它。对吗?您已将数据保存为变量

 then i want to send another data on it but I don't know what is its href,
您可以始终使用一个变量将
url
传递到此页面,然后使用此变量
url
发布到此url

$.post(url, {
"action" : "add_points_for_user",
"search_user" : "data",
"submit_search_user" :"Ok"
}, function(z) {
console.log(z);
// I want to send another data on it (use $.post) without using url 
});

插入
location.href

$.post(location.href, {
   "action" : "add_points_for_user",
   "search_user" : "data",
   "submit_search_user" :"Ok"
}, function(z) {
   console.log(z);
   // I want to send another data on it (use $.post) without using url 
});

不,你不能在没有URL的情况下发送POST请求,这有什么意义?你为什么要这样做?我只是想当我向a/链接发送POST请求时,数据将显示在该数据中,我想再次使用POST请求。我该怎么做?你的问题让人困惑。url不仅仅是href的值吗?否。更多详细信息:当我使用$.post请求/链接时,随后将加载一个数据(页面不会刷新,我称此数据为data)。我想在数据库上发送数据
$.post(location.href, {
   "action" : "add_points_for_user",
   "search_user" : "data",
   "submit_search_user" :"Ok"
}, function(z) {
   console.log(z);
   // I want to send another data on it (use $.post) without using url 
});