$(".a_post").on("click",function(event){
event.preventDefault();//使a自帶的方法失效,即無法調整到href中的URL(https://www.cnblogs.com/)
$.ajax({
type: "POST",
url: "url地址",
contentType:"application/json",
data: JSON.stringify({param1:param1,param2:param2}),//參數列表
dataType:"json",
success: function(result){
//請求正確之后的操作
},
error: function(result){
//請求失敗之后的操作
}
});
});
到此這篇關于html post請求之a標簽的兩種用法解析的文章就介紹到這了,更多相關html post請求 a標簽內容請搜索腳本之家以前的文章或繼續瀏覽下面的相關文章,希望大家以后多多支持腳本之家!