So my ajax success function isn't loading. So I have no idea what's wrong with it. Is there any way I can check that? Like with mysql_error()? For now, if you guys can figure out what is wrong with it, or the PHP that's on the other end, that would be great.
jQuery.ajax({
type: "POST",
url: "http://mywebsite.net/snippetsave.php",
data: {id: snippetID, name: snippetName, content: snippetContent},
cache: false,
success: function(response){
loadsnippet(snippetID);
$("body").attr("saved", "yes");
$("a[snippetid='" + snippetID + "']").addClass("saved");
}
});
and snippetsave.php:
<?php
session_start();
$username = $_SESSION['username'];
$password = $_SESSION['password'];
$connect = mysql_connect(......);
$select_db = mysql_select_db(.....);
if(!$connect){
die(mysql_error());
}
$currentsnippet = mysql_escape_string($_POST['id']);
$snippetnames = mysql_escape_string($_POST['name']);
$snippetcontents = mysql_escape_string($_POST['content']);
$update = mysql_query("UPDATE newsnippets SET name='$snippetnames', content='$snippetcontents' WHERE id='$currentsnippet'");
if (!$update){
die(mysql_error());
}
?>