Im sure this question has been asked before but i cannot seem to get what i need working right for me. i need this ajax to process my php form, i got that for, at least i think. I wrote some ajax to do this and it WILL at least give a responce but nothing in the database is changed so its not actually doing anything, heres my ajax/javascript to add a little more detail the reason im doing this is because i dont want the page to redirect after you hit the submit button. id just like it to pop up a success window or something.
<script>
function no_redirect(){
var note_text=$('#note_text').val();
var cnotes=$('#cnotes').val();
var formData = "note_text="+note_text+"&cnotes="+cnotes;
$.ajax({
url : "addnote.php",
type: "GET",
data : formData,
success: function(data, textStatus, jqXHR)
{
//data - response from server
alert(data);
},
});
}
</script>
and here is my html form
<form action="" method="get">
<div class="span12">
<h4 style="color:#1577a6;">Notes</h4>
<input type="hidden" name="cnotes" id="cnotes" value="<?php echo $tempuser8[$u]; ?>"/>
<textarea class="field span12" id="note_text" name="note_text" type="text" rows="9" maxlength="10000"><?php echo $tempuser9[$u];?>
and just in case here is my php file
$con = mysqli_connect($host,$uname,$pass,$database) or die(mysqli_error($con));
$customer_notes = NULL;
$row = NULL;
$customer_notes = $_GET['note_text'];
$row = $_GET['cnotes'];
// $sql = "INSERT INTO userprofile
// (customer_notes)
// VALUES
// ('".$customer_notes."')";
$note_sql = "UPDATE users SET customer_notes='".$customer_notes."' WHERE id='".$row."'";
$result = mysqli_query($con, $note_sql);
if($result){
// header( "Location: index.php" );
} else{
// echo("Input data has failed Please go back and resubmit");
}
idk why its not working right but i AM getting some ouput to teh screen in teh form of a little windows that has all my code in it and says responce from localhost at the top, not sure if that helps
any and all guidance is greatly appreciated!