title: Problem using sendRedirect in a servlet using Jquery + AJAX
body: <p>I'll try to explain my questions/problem easily.</p>
  
  <p>In my jsp I have some links, one for each message of the forums. When I click any of the ".delete" links, the following script is triggered:</p>
  
  <pre><code>$('.delete').click(function(event) {
      event.preventDefault();
  
      // some data recovering from the jsp's tags
      var idMsg = $(this).closest('.li').attr('id');
      var action = $(this).attr('name');
      var origin = $('div#origin').attr('name');
      ...
  
      // some checking
      //alert('id: '+idMsg);
      ...
  
      // I send the info to delete the message in the servlet
      $.post("../app/ForumCampus", {action:action, idMsg:idMsg, origin:origin}, function(data) {
      });
  
      //$('.output').append('Message deleted successfully.');
  });
  </code></pre>
  
  <p>At first, I didn't want to refresh the page and I only showed the above success message.</p>
  
  <p>But now, due to pagination, I need to refresh the servlet, and I have the following code in the post method:</p>
  
  <pre><code>response.sendRedirect(contextPath+"/app/" + origin);
  </code></pre>
  
  <p>But when AJAX goes to the servlet, does all the stuff (deletes the message correctly) but does not redirect to the servlet. The page didn't refresh. If I refresh the page manually It's all OK, the deleted message doesn't appear.</p>
  
  <p>My questions are:</p>
  
  <p>1) The servlet doesn't redirect because the script isn't finished yet? Why?</p>
  
  <p>2) I can refresh the servlet just typing the following code in the .click event:</p>
  
  <pre><code>location.reload();
  </code></pre>
  
  <p>But, there is way that you consider better? Without using Javascript or something?</p>
  
  <p>Thanks for advance, learning with you is so cool :)</p>