Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
deepthi narendula
Related to ajax+liferay
October 28, 2012 10:56 PM
Answer

deepthi narendula

Rank: Junior Member

Posts: 39

Join Date: April 26, 2012

Recent Posts

Hi All,

my task is :- I am having 2 portlets

In first portlet if i select country (from left side portlet) that country should populate on right side portlet it should be done using ajax....we should not submit on change it should happen...plz help me out...

Thanks & Regards
Deepthi
Muthukumar Thangavinayagam
RE: Related to ajax+liferay
October 28, 2012 11:25 PM
Answer

Muthukumar Thangavinayagam

Rank: New Member

Posts: 22

Join Date: December 16, 2010

Recent Posts

deepthi narendula:
Hi All,

my task is :- I am having 2 portlets

In first portlet if i select country (from left side portlet) that country should populate on right side portlet it should be done using ajax....we should not submit on change it should happen...plz help me out...

Thanks & Regards
Deepthi



Hi Deepthi,

You can use client IPC Call . Liferay providing Client IPC to communicate two different portlets in same page .

Please refer Client IPC link


code snippet :


In First Portlet fire the event :

<script type="text/javascript">
function getCountryID(urlRender,redirectURL){

Liferay.fire('RefreshEvent', {
urlRender: urlRender,
redirectURL: redirectURL

});

}
</script>

In Second Porelt catch the event :

<aui:script use="aui-io-request, aui-loading-mask">

Liferay.on('RefreshEvent',function(event) {

var urlRender = event.urlRender;
var redirectURL = event.redirectURL;

// Here you can generate URL and ccall ajax call by useing jQuery.ajax or AUI ajax call
});

</aui:script>


Best Regards,
Muthukumar Thangavinayagam
deepthi narendula
RE: Related to ajax+liferay
November 5, 2012 3:22 AM
Answer

deepthi narendula

Rank: Junior Member

Posts: 39

Join Date: April 26, 2012

Recent Posts

Hi Friends:

This is my Jsp,i need to delete the record in database for that i am using the following code but my problem is my action deletesearch is not performing..


<script type="text/javascript">
function deleteSearch(ths){
var searchId=$(ths).attr('title');
alert(searchId);
var url = "<%=fetchValues%>";
alert(url + "&searchId=" +searchId+ "&action=deleteSearch");
jQuery.ajax(url + "&searchId=" +searchId+ "&action=deleteSearch", function(data) {
});

}
</script>
This is my serve resource method :-
public void serveResource(ResourceRequest resourceRequest,
ResourceResponse resourceResponse) throws IOException,
PortletException {

System.out.println("in serve resource method");
String action = ParamUtil.getString(resourceRequest, "action");
if(action.equalsIgnoreCase("deleteSearch")){
int searchId=ParamUtil.getInteger(resourceRequest, "searchId");
try {
User_SearchLocalServiceUtil.deleteUser_Search(searchId);
} catch (PortalException e) {
e.printStackTrace();
} catch (SystemException e) {
e.printStackTrace();
}

}

Plz help me out....

Thanks & Regards
N.Deepthi