title: How To Open URL In New Tab Using Ajax Success?
body: <p>Here i am trying to open the file in new tab by calling ViewFile action of Doctor controller using Ajax Success which is in function<code>abc(this)</code> on click of anchor tag. <br>
  Now the problem is that everything is as required but the url doesnot open in new tab.<br><br>
  Below is my Ajax</p>
  
  <pre><code>&lt;script&gt;
  function abc(thisEvent) {
      debugger;
      var getDoCredId = $(thisEvent).attr('docCredId');
      var parameter = { id: getDoCredId };
      $.ajax({
          url: "/Doctor/ViewFile1",
          type: "get",
          dataType: "html",
          data: parameter,
          success: function (data) {
              debugger;
              if (data = true) {
                  debugger;
                  var getdoctorId = $(thisEvent).attr('docCredId');
                  var url = "/Doctor/ViewFile/" + getdoctorId;
                  window.open(url, "_blank");
              }
              else {
                  debugger;
                  showNotification("Error", "warning");
              }
          }
      });
  }
  </code></pre>
  
  <p>
  <br>
  Below is my anchor tag HTML<br><br></p>
  
  <pre><code>&lt;a title="View Attachment"   docCredId = "' + getDocCredId + '"  onclick="abc(this)"&gt;&lt;i class="btn btn-web-tbl btn-warning fa fa-eye "&gt;&lt;/i&gt;&lt;/a&gt;
  </code></pre>
  
  <p><br><br>
  Below is code behind
  <br></p>
  
  <pre><code>public bool ViewFile1(int id)
      {
          var document = _doctorService.GetDoctorCredentialDetails(id);
          string AttachPath = ConfigPath.DoctorCredentialsAttachmentPath;
          string strFileFullPath = Path.Combine(AttachPath, document.AttachedFile);
  
          string contentType = MimeTypes.GetMimeType(strFileFullPath);
          bool checkFileInFolder = System.IO.File.Exists(strFileFullPath);
          if (checkFileInFolder == true)
          {
              return true;
          }
          else
          {
              return false;
          }
    }
      public ActionResult ViewFile(int id)
      {
          var document = _doctorService.GetDoctorCredentialDetails(id);
          string AttachPath = ConfigPath.DoctorCredentialsAttachmentPath;
          string strFileFullPath = Path.Combine(AttachPath, document.AttachedFile);
          string contentType = MimeTypes.GetMimeType(strFileFullPath);
          bool checkFileInFolder = System.IO.File.Exists(strFileFullPath);  
          bool filedata = System.IO.File.ReadAllBytes(strFileFullPath).Any();
          byte[] filedata1 = System.IO.File.ReadAllBytes(strFileFullPath);
          var cd = new System.Net.Mime.ContentDisposition
          {
              FileName = document.FileName,
              Inline = true
          };
          Request.HttpContext.Response.Headers.Add("Content-Disposition", cd.ToString());
          return File(filedata1, contentType);
      }
  </code></pre>