我在将ajax应用于当前代码方面有些挣扎。我是新手,不太确定如何去做。
先谢谢了。
代码:
<script>
function openTab(NetworkTabs,elmnt,color) {
var i, tabcontent, tablinks;
tabcontent = document.getElementsByClassName("tabcontent");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
$.ajax()
tablinks = document.getElementsByClassName("tablink");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].style.backgroundColor = "";
}
document.getElementById(NetworkTabs).style.display = "block";
elmnt.style.backgroundColor = color;
}
document.getElementById("defaultOpen").click();
</script>
答案 0 :(得分:1)
$.ajax({ url:"test.php",
type:"post",//Get,POST or PUT
data:{value='abc'},
success:function(data)
{
//Your code here
}
error:function()
{
}
})