如何在Portlet中加载页面onClick在Dynatree节点的节点上

时间:2011-08-01 08:35:36

标签: javascript jquery ajax

我想在点击时显示jsp页面或innerHTML(将添加HTML内容) dynatree节点的节点。

我正在尝试它,如代码所示,但它没有成功。

请帮助

谢谢!

    // Ajax call


   $.ajax({
   url : TREE_NAV_SERVLET,
   type: "GET",
   data: "pName="+node.data.title,
   dataType : 'text', 
   success : function(responseHTML) {
   alert("ResponseText :: "+responseHTML);//This is working fine

   //not able to load this even though path is correct
   $("[id=content]").attr("src",'/Path/JspToBeLoaded.jsp');

   // or The following

   //This loads the portlet with the with new 
   //content and removes the dynatree which is not required both should be there

   //$("#content").innerHTML(responseHTML);
   }
   });



  //Div tag which is the point where I want to display the data/JSP

  <div id="content"></div> //Response goes here

1 个答案:

答案 0 :(得分:0)

1)你应该总是解释一下“它不工作”是什么意思

2)假设您的意思是警报正常(您看到要插入的html),但是您无法正确插入html,您可以这样做:

 $.ajax({
   url : TREE_NAV_SERVLET,
   type: "GET",
   data: "pName="+node.data.title,
   dataType : 'text', 
   success : function(responseHTML) {
   alert("ResponseText :: "+responseHTML);

     $("#content").html(responseHTML);
   }
   });

  <div id="content"></div>//response goes here