I’m working on a homepage and will use an AJAX inline editing script for the admin to make it as simple as possible. The script I’ve been using is this and it has almost everything I wanted from an inline editing script. My problem arises when I’m going to capture the new changes and send them to a PHP function which will update my database with those new changes.
I don’t have that much experience with AJAX and PHP together so I’m somewhat lost but I’ve tried a code I found:
$.ajax({
type: "POST",
url: "update_handler.php",
data: "newfieldvalue=" + newValue,
success: function(msg){
alert( "Data Saved: " + msg );
}
});
The problem is that I don’t quite know how or where to implement this code or if it’s even the right code to use. To show you the code I’ve attached two txt documents:
And
In index.php.txt
is the index page where it retrieves my data from the database and uses a bit of jQuery code. In the jQuery.editableText.js.txt
is the concrete jQuery code. I guess that the PHP handler page is pretty much standard with taking the correct field and then update it in the database.