2010-10-16 41 views
1

我已經建立了一個portlet Liferay Portal並使用了Ajax。當我在沒有www的情況下打開網站時,一切都是正確的,但是當我使用www時,Ajax請求URL沒有www,然後響應爲空。我的Liferay Portal版本是5.1.1,我使用plugins-sdk並使用Struts 2 portlet和JSR 168在不同的窗口狀態的Liferay Portal中的URL問題

我注意到,如果我想請求一個窗口狀態不正常的portlet嗎?我應該在正常狀態之前請求該portlet,並且如果請求是www或沒有www,則第二個請求與正常請求(正常windowState)相同。

jQuery.ajax({ 
    url : '<portlet:actionURL windowState="exclusive" > 
      <portlet:param name="struts.portlet.action" value="/view/view/search"/>  </portlet:actionURL >' , 
    data : <portlet:namespace/>form_data , 
    success : function (result){ 
        jQuery("#<portlet:namespace/>search_results").html(result); 
       } 
}); 

actionURL未添加www到URL。

如何解決這個問題?

回答

0
jQuery.ajax({ 
    url : '<portlet:renderURL windowState="exclusive" > 
      <portlet:param name="struts_action" value="/view/view/search"/>  </portlet:renderURL >' , 
    data : <portlet:namespace/>form_data , 
    success : function (result){ 
        jQuery("#<portlet:namespace/>search_results").html(result); 
       } 
}); 
+1

嘗試添加評論而不僅僅是代碼......它可以幫助人們理解爲什麼它是一個問題的解決方案。 – nickhar 2012-11-25 02:43:51