Your code is in order, different from the fact that it does not include an error handler (one of the reasons I don't like $.post
). I think the POST operation should result in an error. Try converting it to this:
$.ajax({ type: "POST", url: "/"+contentId+"/postComment", data: {"postComment":""}, success: function(data) { alert('call back'); }, // vvv---- This is the new bit error: function(jqXHR, textStatus, errorThrown) { alert("Error, status = " + textStatus + ", " + "error thrown: " + errorThrown ); } });
... so you can see what a mistake is.
source share