const url = new URL('https://yourdomain.com/products/?add-products%5B0%5D%5Bproduct-id%5D=16&add-products%5B0%5D%5Bquantity%5D=5&add-products%5B0%5D%5Bprice%5D=25.000&add-products%5B1%5D%5Bproduct-id%5D=17&add-products%5B1%5D%5Bquantity%5D=7&add-products%5B1%5D%5Bprice%5D=84.000&add-products%5B2%5D%5Bproduct-id%5D=15&add-products%5B2%5D%5Bquantity%5D=10&add-products%5B2%5D%5Bprice%5D=100.000&product-name=0&quantity=0&price=0&object_id=31');
const obj2 = Object.fromEntries(new URLSearchParams(url.search));
//javascript
var xhttp = new XMLHttpRequest();
xhttp.open("POST", "ajaxfile.php", true);
xhttp.setRequestHeader("Content-Type", "application/json");
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var response = this.responseText;
}
};
xhttp.send(JSON.stringify(obj2));
//jquery Ajax
$.ajax({
url: 'ajaxfile.php',
type: 'post',
data: obj2,
success: function(response){
console.log(response);
}
});