bit unsure ajax request
bit unsure ajax request
I made a form that submits data to a php form
my code to subit the form looks like this
-
<script type="text/javascript">
$(function() {
// alert("running");
$(".button").click(function() {
var FirstName = $("input#FirstName").val();
var Surname = $("input#Surname").val();
var Ext = $("input#Ext").val();
var Mobile = $("input#Mobile").val();
var Room = $("input#Room").val();
var Office = $("select#Office").val();
var userid = $("input#userid").val();
var dataString = 'userid='+ userid + ' FirstName='+ FirstName + '&Surname=' + Surname + '&Ext=' + Ext + '&Mobile=' + Mobile + '&Room=' + Room + '&Office=' + Office;
//alert (dataString);return false;
$.ajax({
type: "POST",
url: "forms/php/user_info.php",
data: dataString,
success: function() {
//Runs on Form Sucsess
$('#User_info_form').html("<div id='message'></div>");
$('#message').html("<h2>Changes Made!</h2>").hide().fadeIn(1500, function() {$('message');});
$('#form').load('forms/user_info.php');
//END
}
});
return false; //Stops form from refreshing page
}); //end button click
});//End doc.ready
</script>
it submits the form without reloading the page and works good at that.
my problem is I am not sure how to view the php page to see if it is doing what it should be doing. is there away to make the $.ajax function return the php page output, it sounds like it should be really simple but I am struggling to understand the web sites I have been reading about it all
