Liferay Inter-portlet communication(client side)


It's very easy to do that. Liferay provides script to do that.
This is the syntax:
 Liferay.fire(eventName, data)
 Liferay.on(eventName, function, [scope])

In my case, one portlet just sends an event out. The other portlet only needs to refresh itself.
Liferay.fire('iFramePortletReload', 'iFramePortletReload');
Liferay.on('iFramePortletReload', function(event, data) { window.location.reload();//Liferay.Portlet.refresh('#p_p_id'); });
window.location.reload();//When I use this script, actually it'll refresh the current liferay page not only the portlet which receives the event. 
Liferay.Portlet.refresh('#p_p_id');//this statement will only refresh current portlet which receive the event.