Foren

Related to ajax+liferay

deepthi narendula, geändert vor 11 Jahren.

Related to ajax+liferay

Junior Member Beiträge: 39 Beitrittsdatum: 26.04.12 Neueste Beiträge
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
thumbnail
Muthukumar Thangavinayagam, geändert vor 11 Jahren.

RE: Related to ajax+liferay

New Member Beiträge: 22 Beitrittsdatum: 16.12.10 Neueste Beiträge
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, geändert vor 11 Jahren.

RE: Related to ajax+liferay

Junior Member Beiträge: 39 Beitrittsdatum: 26.04.12 Neueste Beiträge
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