Welcome to WebmasterWorld Guest from 54.83.81.52

Forum Moderators: open

Using AJAX to Submit a Form to PHP

     
11:33 pm on Dec 20, 2017 (gmt 0)

Preferred Member

10+ Year Member

joined:Apr 28, 2003
posts: 486
votes: 1


I am using the below code to try to submit a form with id="profileForm" to a page named "process_form.php" where the values of the form get inserted into a mysql database. But I cannot get the code to work. I've been working at this for some time and tried a lot of revisions after researching on Google and here on WW. Many of the examples look extremely similar to my code so I dont know what I'm doing wrong.

<script type="text/javascript">

var dataString = $("#profileForm").serializeArray();

$.ajax({
type:'POST',
url: 'process_form.php',
dataType:'text',
data: dataString,
success: function(data){
alert(data);
},
error:function (data){
alert(thrownError);
}
});
</script>

It seems like the code isn't even calling "process_form.php" successfully.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members