[eluser]adityajoshi[/eluser]
html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Sign Up!</title>
<link rel="stylesheet" href="http://localhost/ci_series/css/style.css" type="text/css" media="screen" />
[removed][removed]
</head>
<body>
<div id = "posts">
Badminton
</div>
<div id = "comments">
I am at dr bombays
</div>
<div id = "comments">
is aj
aj is
</div>
<h1>Contact Us!</h1>
<div id="contact_form">
<form action="http://localhost/ci_series/index.php/contact/submit" method="post">
<input type="hidden" name="entry_id" value="1" />
<input type='text' name='name' value='Name' id='name'/><input type="submit" name="submit" value="Submit" id="submit" /></form> </div>
<div id="main_content">
</div>
<hr >
<div id = "posts">
Badminton
</div>
<div id = "comments">
I am at dr bombays
</div>
<div id = "comments">
is aj
aj is
</div>
<h1>Contact Us!</h1>
<div id="contact_form">
<form action="http://localhost/ci_series/index.php/contact/submit" method="post">
<input type="hidden" name="entry_id" value="1" />
<input type='text' name='name' value='Name' id='2'/><input type="submit" name="submit" value="Submit" id="submit" /></form> </div>
<div id="main_content">
</div>
<hr >
[removed]
$('#submit').click(function() {
var name = $('#name').val();
if (!name || name == 'Name') {
alert('Please enter your name');
return false;
}
var form_data = {
name: $('#name').val(),
email: $('#entry_id').val(),
ajax: '1'
};
$.ajax({
url: "http://localhost/ci_series/index.php/contact/submit",
type: 'POST',
data: form_data,
success: function(msg) {
$('#main_content').html(msg);
}
});
return false;
});
[removed]
</body>
</html>
the problem is that only first submit button work in ajax rest don't they refresh the page