title: how to open view result from action call from javascript
body: <p>i'm developing using ASP.Net mvc 4. I have a delete function in my Index view. Before user proceed to delete an item, this is the steps to go through</p>
  
  <ol>
  <li><p>pop-up a confirm dialog to get the 'yes' or 'no' answer using javascript. </p></li>
  <li><p>If the user say 'yes', I call the delete action from my controller</p></li>
  <li><p>the delete action remove the item from database</p></li>
  <li><p>the delete action return 'RedirectToAction ("Index");'</p></li>
  <li><p>.. suppose the view will be updated with latest update</p></li>
  </ol>
  
  <p>Step 5 is my problem.. its not working</p>
  
  <p>Here is my code</p>
  
  <p>The delete button</p>
  
  <pre><code>&lt;a href="@Url.Action("DeleteFile", new { id = @item.Id })"  
      onclick = "return confirm2delete(this);"
      class="btn btn-danger btn-sm" 
      data-toggle="tooltip" title="Delete File"&gt;
      &lt;i class="fa fa-trash-o"&gt;&lt;/i&gt;
  &lt;/a&gt;
  </code></pre>
  
  <p>The javascript</p>
  
  <pre><code>function confirm2delete(obj)
  {      
      deleteLinkObj = $(this);
      w2confirm("Are sure to delete this file ?")
      .yes(function () {
          $.get(obj.href, function (data) {
              alert(data); // i checked ..this return the html page created from the delete action
              window.open (data); // not the right approach ???
          });
  
      })
      .no(function () {
          alert("no");
          result = false;
      });
      return false;
  }
  </code></pre>
  
  <p>The delete action in my controller</p>
  
  <pre><code>public ActionResult DeleteFile(int id)
  {
      FileUpload f = db.FileUploads.Find(id);
      try
      {                
          FileInfo dfile = new FileInfo(f.fileUrl);
          if (dfile.Exists) { dfile.Delete(); }
          fileUrl = f.FileUrl.Replace("Images/Uploads", "Images/Thumbnails");
          FileInfo thumbnail= new FileInfo(fileUrl);
          if (thumbnail.Exists) { thumbnail.Delete(); }
          db.FileUploads.Remove(f);
          db.SaveChanges();
      }
      catch (Exception ex)
      {
      }
      return RedirectToAction("Index");  // or may i should return something else to make it work in javascript ???
  }
  </code></pre>
  
  <p>Hope you guys can help me. I've been searching and trying for days to come to this level and I feel its time get some help. Just a little bit more. Almost there.</p>