2013-07-25 53 views
0

大家好,我想知道是否可以這樣做? 首先我使用$.post來發布數據到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 
}); 
+4

不,你不能發送一個POST請求而沒有一個URL來發送它,這是什麼意思? – adeneo

+0

你爲什麼要這樣做 –

+0

我只想當我發送一個post請求到一個/鏈接一個數據將顯示在那個數據我想再次使用post請求我該怎麼辦? –

回答

1
If it is possible or not 

號這是不可能的,沒有任何網址發佈的數據。如果你不想把它發送到別的地方,有什麼意義呢?然後你可以擁有這個變量,並將它們用在任何你想要的地方而不是發佈它。對?您將數據保存爲變量。

then i want to send another data on it but I don't know what is its href, 

你總是可以有一個變量,它會通過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 
}); 
0

插入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 
}); 
相關問題