I'm having issues setting up an ajax call in Liferay. In my View.jsp, I have:
<portlet:actionURL name="action" var="action" />
AUI().ready(function(A) {
A.use('.button').on('click',function(){
A.io.request('${action}', {
method: 'POST',
data: {
key1: 'value'
},
on: {
success: function() {
debugger;
alert(this.get('responseData'));
}
}
});
});
});
and in my Portlet.java, I have:
public void action(ActionRequest actionRequest, ActionResponse actionResponse)
throws IOException, PortletException {
System.out.println("hello world");
}
The result is that an ajax call is being made, and it is hitting my action, but then its proceeding to hit the view.jsp that I'm currently on. Is there a way to tell liferay to hit a different jsp file?