我使用Ajax將表單數據提交到另一個頁面,然後將瀏覽器重定向到該頁面。這是我正在使用的代碼:發送POST和GET請求的Ajax請求
$(".step").submit(function(e){
e.preventDefault();
$.ajax({
url: "/dashboard/step2/",
type: "post",
data: paramObj,
success: function(response){
console.log(response);
window.location.href="/dashboard/step2/";
}
});
});
但是,此代碼發送POST和GET請求。這會導致其他問題,因爲我有其他函數依賴於唯一發送的請求是POST請求的事實。任何想法或建議?
什麼問題呢它導致?它應該如何表現? – FakeRainBrigand
我有另一個函數,當GET請求發送時退出 –