noobie : facebook load different pdf in to a div via a link

noobie : facebook load different pdf in to a div via a link

hi

i wonder is someone can help me i am a bit of a noobie and trying to do a simple facebook static html page which allows the users to select a link and it then loads a pdf in to the same div on the page

i basically trying reading a few articles and combing them but able to see it working

so i have 3 or 4 links at the page which will then pass a filename to a function to basically update the div statement

i have put a dummy - blank.pdf to load at start up just to stop errors when i was trying to test it all out (after using a manual link to see that it was working and could pick up a pdf file

do i need to refresh the div at the end of the function
something like this

  1. $(""+elementSelector+"").fadeOut('slow').load('reload.php').fadeIn("slow"); }, 1);
this is a snipet i grab from a page there is no reload.php file so i presume it can be a # sign to resend it to the page  (i dont know only guessing)

here is my code as it stands

  1. <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js">
    function loadContent(elementSelector, sourceUrl) {
    $(""+elementSelector+"").attr("src",""+sourceURL+"");

    }
    </script> 
     

    <body>
    <p>Please click link1 or link2 to load the appropriate pdf <br/><br/></p>
    <a href="javascript:loadContent('#content','http://www.education.gov.yk.ca/pdf/pdf-test.pdf');">Link 1</a>
    <a href="javascript:loadContent('#content','http://www.sanface.com/pdf/test.pdff');">Link 2</a>
    <div id="content">   

        <embed src="blank.pdf" width="500" height="375"  type="application/pdf" />

    </div>


    </body>


















the only other thing is also to make it compliant to

  1. <object data="blank.pdf" type="application/pdf" width="300" height="200">
      alt :
    <a href="blank.pdf">blank.pdf</a>
    </object>
thus i presume i need to change my function to be
  1. function loadContent(elementSelector, sourceUrl) {
    $(""+elementSelector+"").attr("data",""+sourceURL+"");
    $(""+elementSelector+"").attr("href",""+sourceURL+"");
    }


am i on the right tracks, is there a better way of doing this

many thanks