0

I am struggling a bit to apply ajax to my current code. I am new and not too sure how to go about it.

Thanks in advance.

Code:

<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>

1 Answers1

1
$.ajax({ url:"test.php",
        type:"post",//Get,POST or PUT
        data:{value='abc'},
        success:function(data)
         {
         //Your code here
         }
        error:function()
         {

         }
   })
Deepak A
  • 1,624
  • 1
  • 7
  • 16