10 Jul 15 - 01:14
I promised in a previous blog post that I would be sharing the auto save function.
##Function The purpose of these two scripts, are to act as an autosave function for blog posts. It can of course the repurposed for anything else but this is what it was originially intended for.
If they do exist, the PHP script will run an update, if they do not exist, PHP will insert those values into the database.
Ensure that ‘var url’ is = to the name of your php script which captures the input. In this case, it’s simply ‘autosave.php’
var httpc = new XMLHttpRequest(); // simplified for clarity var url = "autosave.php"; // PHP script that you'll be passing data to httpc.open("POST", url, true); // sending as POST
var httpc = new XMLHttpRequest(); // simplified for clarity var url = "path/to/folder/autosave.php"; // PHP script that you'll be passing data to httpc.open("POST", url, true); // sending as POST