Jquery UI portlet-使用Ajax加载和编辑portlet


Jquery UI Portlets - Loading and Editing portlet using Ajax

全部,

我正试图使用PHP、MySQL和JQueryUI创建一个igoogle接口,我在这里偶然发现了jqueryUI的Portlet:

http://jqueryui.com/demos/sortable/portlets.html

对于每个portlet,有没有一种方法:

  1. 要指定URL并加载ajax内容吗
  2. 要有一个编辑按钮,它将在适当的位置编辑portlet。这个编辑内容可以通过
    使用ajax的URL

有关更多详细信息,请查看此处的"编辑"功能:

http://james.padolsey.com/demo/tut-inettuts-with-cookies/

感谢

您可以使用以下示例更改Portlet的内容:

http://jsbin.com/imese4/2

您可以使用load()而不是.html()(为了简单起见,在示例中使用)。

$(".portlet").each(function(element){
      $(this).children(".portlet-content").load("content.php?id="+element);
});

要编辑内容,请执行以下操作:

$(".portlet-edit").click(function(element){
  s=prompt('Enter your content','Content');
  $(this).parent().children(".portlet-content").html("edited:" + s);
});