62
rated 0 times
[
65]
[
3]
/ answers: 1 / hits: 41181
/ 10 Years ago, wed, april 9, 2014, 12:00:00
I want to submit this form via jquery ajax, this is what I have made and it is not working. i.e. Form is submitting with page refresh and I am not seeing the response i.e. printing array on the same page.
HTML
<link rel='stylesheet' type='text/css' href='css/pepper-grinder/jquery-ui-1.10.4.custom.css' />
<script type='text/javascript' src='js/jquery-1.10.2.js' ></script>
<script type='text/javascript' src='js/jquery-ui-1.10.4.custom.min.js' ></script>
<form id=form1 method=get action=submit.php >
<label>Name of Organization</label>
<input type=text name=OrgName id=OrgName class=textfield>
<label>Address of Organization</label>
<input type=text name=OrgAddress id=OrgAddress class=textfield>
<input type=submit value=Register Organization>
</form>
<div id=response>ads</div>
<script>
$document.ready(function(){
$(#form1).click((function(event){
event.preventDefault();
$.ajax({
url:'submit.php',
type:'GET',
data:$(this).serialize(),
success:function(result){
$(#response).text(result);
}
});
});
});
</script>
PHP (submit.php)
<?php
print_r($_GET);
?>
More From » php