Cannot load CSS and JS dynamically with this function
<p>I am trying to load Plugins based on the condition as in the below function. But i am unable to do it. Please have a look at the code and let me know the errors in the code..</p>

<pre><code>  function loadPlugin(choic)
  {
    var plugin=choic*1;
    if(plugin &gt;= 1 &amp;&amp; plugin &lt;= 3)
    {
        $("head").append("&lt;link&gt;");
        css = $("head").children(":last");
        css.attr(
            {
                rel:  "stylesheet",
                type: "text/css",
                href: "/cloud-zoom/cloud-zoom.css"
            });
        alert('CSS Loaded');
        alert($("head").html());
        $.getScript('/cloud-zoom/cloud-zoom.1.0.2.min.js', function() 
        {
            alert($("head").html());
            $('.cloud-zoom').CloudZoom();
            $('a.cloud-zoom').live('click',function(e)
            {
                e.preventDefault();
            });
        });
    }   
   }
</code></pre>

<p>Thanks</p>
