js create a post function code example
Example 1: javascript send post
var xhr = new XMLHttpRequest();
xhr.open("POST", yourUrl, true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.send(JSON.stringify({
value: value
}));
Example 2: $.post javascript
//$.post with jQuery
$.post(
"path/to/your/php/file",
{
param1: "Value",
param2: "Value"
},
function(data) {
//Callback here
}
);