如何动态加载js小部件?

时间:2014-09-11 17:14:56

标签: javascript jquery

我想将带有jquery的新闻Feed小部件加载到div中,但它只会加载没有Feed的引荐链接

example here

下面的代码

的index.php:

$(document).ready(function(){
      $("#link").click(function(){
         $.ajax({
            type:"POST",
            url="widget.php",
            data: "id="+1,
            success: function(data){
              $("#show").html(data);
            }
         });
      });
   });

<div id="show">show things will replace me</div>
<a href="#" id="link">Show stuff</a>

widget.php:

<script charset="utf-8" src="http://www.newsfiber.com/p/s/j?lang=eng&iv=4&r=10&is=60x60C&n=eng&y="></script>
   <div name="_dsnnginf_634080201465X579_" id="_dsnnginf_634080201465X579_" style="font-weight: 400; text-align: left; padding: 0.2em; background-color: #E9E9F0; font-size: 95%; font-family: Georgia,Palatino,Arial,Times,Times New Roman,serif;">
   <a style="text-decoration: none; color: #0000EE;" href="http://www.newsfiber.com/p/s/h?n=eng&y=" target="_blank">
      News
   </a> at 
   <a style="text-decoration: none; color: #0000EE;" href="http://www.newsfiber.com/" target="_blank">
      www.newsfiber.com
   </a>
</div>

0 个答案:

没有答案