Javascript 如何在动态树节点的节点上单击portlet onClick加载页面

Javascript 如何在动态树节点的节点上单击portlet onClick加载页面,javascript,jquery,ajax,Javascript,Jquery,Ajax,我想在单击时显示jsp页面或innerHTML(将添加HTML内容) 动态树节点的节点 我正在按代码所示进行尝试,但没有成功 请帮忙 谢谢 // Ajax call $.ajax({ url : TREE_NAV_SERVLET, type: "GET", data: "pName="+node.data.title, dataType : 'text', success : function(responseHTML) { alert("

我想在单击时显示jsp页面或innerHTML(将添加HTML内容) 动态树节点的节点

我正在按代码所示进行尝试,但没有成功

请帮忙

谢谢

    // 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
//Ajax调用
$.ajax({
url:TREE_NAV_SERVLET,
键入:“获取”,
数据:“pName=“+node.data.title,
数据类型:“文本”,
成功:功能(responseHTML){
警报(“ResponseText::”+responseHTML);//工作正常
//即使路径正确,也无法加载此文件
$(“[id=content]”)attr(“src”,'/Path/jsptobloaded.jsp');
//或以下
//这将使用新的
//内容并删除不需要的动态树,两者都应该存在
//$(“#内容”).innerHTML(responseHTML);
}
});
//Div标记,这是我想要显示数据/JSP的点
//答案就在这里
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
$.ajax({
url:TREE_NAV_SERVLET,
键入:“获取”,
数据:“pName=“+node.data.title,
数据类型:“文本”,
成功:功能(responseHTML){
警报(“ResponseText::”+responseHTML);
$(“#content”).html(responseHTML);
}
});
//答案就在这里