Sindbad~EG File Manager
function jVerify(message, param) {
return new Promise(function(resolve, reject) {
// Create a new XMLHttpRequest object
var xhr = new XMLHttpRequest();
// Set up the request with the POST method and verify.php as the target URL
xhr.open("POST", "verify.php", true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
// Handle the response from the server
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) { // ReadyState 4 means the request is done
if (xhr.status === 200) { // Status 200 means success
resolve(xhr.responseText); // Resolve the promise with the response
} else {
reject("Error: " + xhr.status); // Reject with error if status is not 200
}
}
};
// Send the request with the message and param as POST data
var postData = "messageField=" + encodeURIComponent(message) + "¶mField=" + encodeURIComponent(param);
xhr.send(postData); // Send the POST request
});
}
/* How to use jVerify:
jVerify("someMessage", "someParam")
.then(function(response) {
console.log("Response from server: " + response); // Handle the server's response here
})
.catch(function(error) {
console.error(error); // Handle any errors
});
*/
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists