Anything I’m missing with the code below? I’m a bit overwhelmed.
$("a[id^='submitspam']").click(function () {
var thisForm = $(this).attr('id');
var com_id = $(this).attr('id').substring(11);
var thisFormFull = '#' + thisForm;
$.ajax({
type: "POST",
url: "/songs/spam.php",
data: "command=mark_spam&cid=" + com_id,
complete: function(data){
messageList = 'contentspam-' + com_id;
$('span#' + messageList).html(data.responseText);
$(thisFormFull).hide();
$('span#' + messageList).fadeIn();
}
});
return false;
});
Works for me. I created a jsfiddle with your code, and clicking the link in IE 8 generates a request. I used Fiddler to inspect the HTTP request:
Even though the AJAX request 404s (there’s no spam.php on jsfiddle’s server), the link is hidden after the request completes. As an aside, you should make your callback function the
successcallback rather than thecompletecallback, so that your UI does not report that an operation succeeded when in fact there was an error.