【问题标题】:Jquery UI Portlets - Loading and Editing portlet using AjaxJquery UI Portlets - 使用 Ajax 加载和编辑 portlet
【发布时间】:2011-09-15 23:38:06
【问题描述】:

全部,

我正在尝试使用 PHP、MySQL 和 JQuery UI 创建一个 igoogle 界面,我在这里偶然发现了 jquery UI 的 portlet:

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

对于每个portlet,有没有办法:

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

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

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

谢谢

【问题讨论】:

    标签: php jquery ajax jquery-ui jquery-ui-sortable


    【解决方案1】:

    您可以使用以下示例更改 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);
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-13
      • 1970-01-01
      • 2012-04-18
      • 1970-01-01
      • 1970-01-01
      • 2012-05-13
      相关资源
      最近更新 更多