using jquery to check if a pdf file exists on the server... .load()?

using jquery to check if a pdf file exists on the server... .load()?

hi guys,
i'm new to this jquery stuff. I am looking for a solution for the problem described above. In the given case i am building a dynamic from where a user can enter 2 inputvalues and should then be provided with a link for a pdf file.
to get this thing right, i need to check if a file exists on the server while the user  is typing.
see following method:
  1. function getPDFLink() {
  2.     var a=document.getElementById("pk").value;
  3.     var b= document.getElementById("folge").value;
  4.   
  5.     if(a.length = 15 && b.length == 3) {
  6.          // static way without check
  7.          document.getElementById("pdfLnk").innerHTML = "<a href="fileadmin/pdffiles/"+a+b+".pdf" target='blank'>PDF anzeigen</a>";
  8. /dynamic way fails
  9.         $(".pdflink").load("fileadmin/pdffiles/"+a+b+".pdf", function(response, status, xhr) {
  10.              if (status == "error") {
  11.                 var msg = "Sorry but there was an error: ";
  12.                 $(".pdflink").html(msg + xhr.status + " " + xhr.statusText);
  13.             }
  14.         });
  15.     }
  16. }
now here's the point. I dont want the pdf to be loaded in the <a> tag. i want to evaluate the response values and provide a link when 200 is returned... otherwise a errormessage should be shown.

i hope you guys can help me with this one.

kind regards

michael