2011-08-01 79 views
0

我想要顯示一個jsp頁面或innerHTML(它將添加HTML內容),點擊 dynatree節點的節點。如何在Portlet上加載頁面點擊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 

回答

0

1)你應該總是說明你是什麼意思與「它不工作」

2)假設你的意思是,警報是OK(你看到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