0

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?

2
Contributors
3
Replies
6
Views
5 Years
Discussion Span
Last Post by AleMonteiro
0

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.

0

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?

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.