$.post javascript

JavaScript
const postData = async ( url = '', data = {})=>{
    console.log(data);
      const response = await fetch(url, {
      method: 'POST', 
      credentials: 'same-origin',
      headers: {
          'Content-Type': 'application/json',
      },
     // Body data type must match "Content-Type" header        
      body: JSON.stringify(data), 
    });

      try {
        const newData = await response.json();
        console.log(newData);
        return newData;
      }catch(error) {
      console.log("error", error);
      }
  }
//$.post with jQuery

$.post(
  "path/to/your/php/file", 
  {
    param1: "Value",
    param2: "Value"
},
  function(data) {
  //Callback here
  }
);

Source

Also in JavaScript: