jQuery ajax response not operating correctly
        Posted  
        
            by mmarceau
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by mmarceau
        
        
        
        Published on 2010-05-25T13:21:53Z
        Indexed on 
            2010/05/25
            13:31 UTC
        
        
        Read the original article
        Hit count: 230
        
Ok this is frustrating... The code below works "correctly" as far as sending the email address to the SaveEmail URL and it gets saved correctly each time I change the drop down. However it only outputs the "Successful" message once, no matter how many times I change the value in the drop down. The "data" that is returned is "Successful". I would like to show the message for a couple seconds, then fade it out. It works correctly the first time I change the drop down, after that the change happens and the value gets saved, but the "Successful" message doesn't display.
jQuery code:
$('#AgentEmails').change(function() {
  var NewAddress = $('#AgentEmails').val();
  $.post('SaveEmail.aspx', { email: NewAddress }, function(data) {
    $('#SelectMsg').html("<b>" + data + "</b>").fadeOut();
  });
});
HTML code:
<select ID='AgentEmails' runat='server'>
  <option value="[email protected]">TEST</option>
</select><span id='SelectMsg'></span>
What needs to be changed in my code to make this operate correctly? Thanks for the help.
© Stack Overflow or respective owner