Welcome Guest, Not a member yet? Register   Sign In
I have multiple submit button i am using jquer ajax one one button works
#1

[eluser]adityajoshi[/eluser]
Code:
<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]
[removed]
$(document).ready(function() {
$('#load').hide();
});

$(function() {
$(".contact_form").click(function() {
$('#load').fadeIn();
var commentContainer = $(this).parent();
var id = $(this).attr("id");
var string = 'id='+ id ;

$.ajax({
   type: "POST",
   url: "delete.php",
   data: string,
   cache: false,
   success: function(){
commentContainer.slideUp('slow', function() {$(this).remove();});
$('#load').fadeOut();
  }
  
});

return false;
});
});


[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">
   &lt;form action="http://localhost/ci_series/index.php/contact/submit" method="post"&gt;
   &lt;input type="hidden" name="entry_id" value="1" /&gt;
   &lt;input type='text' name='name' value='Name' id='name'/&gt;&lt;input type="submit" name="submit" value="Submit" id="submit" />&lt;/form&gt; </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">
   &lt;form action="http://localhost/ci_series/index.php/contact/submit" method="post"&gt;
   &lt;input type="hidden" name="entry_id" value="1" /&gt;
   &lt;input type='text' name='name' value='Name' id='2'/&gt;&lt;input type="submit" name="submit" value="Submit" id="submit" />&lt;/form&gt; </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]


&lt;/body&gt;

&lt;/html&gt;


its a php code any one can test the only problem is only first submit button works
any help will be highly appreciated




Theme © iAndrew 2016 - Forum software by © MyBB