title: check file exists on folder on server using jquery ajax
body: <p>I am trying to check file exist on server using ajax. i have used below script
  my server name is like <strong>www.Mydomain.netp/Application_Folder/</strong>  </p>
  
  <pre><code> var fileobj="../invoices/"+filename+".pdf";
  
    var pdfurl;
       $.ajax({
        url: fileobj, //or your url
      success: function(data){
  
       alert('exists');
     pdfurl = "http://Mydomain.orgi/Application_Folder/Invoices/" + Invoiceid + ".pdf";
  
           window.open(pdfurl, "PopupWindow", "width=600,height=600,scrollbars=yes,resizable=no");
  
       },
        error: function(data){
  
  
  
              alert('does not exists');
  
                 pdfurl = "http://AnotherDomain.orgi/Invoices/" + Invoiceid + ".pdf";
                   window.open(pdfurl, "PopupWindow", "width=600,height=600,scrollbars=yes,resizable=no");
     },
   });
  </code></pre>
  
  <p>If file exists that time also i am getting into error part,
  any other alternative ways to do this. above script perfect with localhost but not working on production environment</p>