i am trying to submit a form in jquery without refreshing it.
for my jquery code i have this:

$(function() {
    $(".submitbuttonsend").click(function() {
  var dataString = 'reqtoid=<?php echo $uid; ?>&reqfromid=<?php echo $id; ?>';
  $.ajax({
    type: "POST",
    url: "proccess.php",
    data: dataString,
    success: function() {
      $('#freekk').html("<div id='message' style='color: #4f4f4f; font-size: 12px; display: inline;'></div>");
      .fadeIn(1500, function() {
        $('#message').append("ClassMate request sent!");
      });
    }
  });
  return false;
    });
  });

and for my html i have:

<table cellspacing=0 cellpadding=0 class=center style='text-align: center;'><tr><td style='text-align: center;'><div style='display: inline; margin-left: auto; margin-right: auto; text-align: center;' id='freekk'><input type=submit value='Add ClassMate' class='nrbutton submitbuttonsend' style='width: 150px;'></div></td></tr></table>

but when i click the button, nothing happens. can anybody help me?

Hi, two things:

first your code has an error, the correct is:

success: function() {
      $('#freekk').html("<div id='message' style='color: #4f4f4f; font-size: 12px; display: inline;'></div>")
      .fadeIn(1500, function() {
        $('#message').append("ClassMate request sent!");
      });
    }

second, change the attribute type from submit to button, like this:

<input type=button value='Add ClassMate' class='nrbutton submitbuttonsend' style='width: 150px;'>

Hope it helps.

so now i have

$(function() {
    $(".submitbuttonsend").click(function() {
  var dataString = 'reqtoid=<?php echo $uid; ?>&reqfromid=<?php echo $id; ?>';
  $.ajax({
    type: "POST",
    url: "proccess.php",
    data: dataString,
    success: function() {
      $('#freekk').html("<div id='message' style='color: #4f4f4f; font-size: 12px; display: inline;'></div>")
      .fadeIn(1500, function() {
        $('#message').append("ClassMate request sent!");
      });
    }
  });
  return false;
    });
  });

and it still isnt working. any ideas?

First debug it, use FireBug on FF or Dev tools on IE.

If it doesn't show any errors, try and put some alerts to see where the code is entering.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.