how to get array of ajax value in action class

madhukara patel, módosítva 10 év-val korábban New Member Bejegyzések: 8 Csatlakozás dátuma: 2014.10.08. Legújabb bejegyzések
This is my javascript code.

function getCommitteCode(val){
var regions = $("#<portlet:namespace/>countryId").val();
var selectednumbers = [];
$('#<portlet:namespace/>countryId :selected').each(function(i, selected) {
selectednumbers = $(selected).val();
});


console.log(selectednumbers);
$.ajax({
url : '${getRegion}',
data: {
<portlet:namespace/>reg:selectednumbers
},
type : 'POST',
dataType: "text",
success : function(data) {


}
});
}


action class code


String[] organizationId = ParamUtil.getParameterValues(resourceRequest, "reg");



am getting null values . pls help some one on this.


Thank you in advance
thumbnail
David H Nebinger, módosítva 10 év-val korábban Liferay Legend Bejegyzések: 14933 Csatlakozás dátuma: 2006.09.02. Legújabb bejegyzések
For ajax you should be using resource requests, not action requests.
thumbnail
Meera Prince, módosítva 10 év-val korábban Liferay Legend Bejegyzések: 1111 Csatlakozás dátuma: 2011.02.08. Legújabb bejegyzések
Hi
Here is example it helps you..

http://www.liferaysavvy.com/2014/01/content-auto-update-using-jquery-ajax.html
http://www.liferaysavvy.com/2014/01/content-auto-update-using-aui-ajax-in.html

Prepare JSONArray using liferay JSON API to send array of values as ajax response.

Regards,
Meera Prince
thumbnail
Liferay Dev, módosítva 10 év-val korábban Junior Member Bejegyzések: 81 Csatlakozás dátuma: 2015.05.17. Legújabb bejegyzések
JSP:

<liferay-portlet:actionURL name="markEvent" var="markEventURL">
</liferay-portlet:actionURL>
<script>

function markAsReadURLJS(userEventId){
AUI().use('aui-io-request', function(A){
A.io.request( '<%=markEventURL%>', {
method: 'post',
data: {'<portlet:namespace/>userEventId': userEventId},
on: {
success: function() {
// console.log(this.get('responseData'));
}
}
});
});

}

</script>
JAVA:
public void markEvent(
ActionRequest actionRequest, ActionResponse actionResponse)
throws Exception {
logger.debug("in markEvent");
ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(
WebKeys.THEME_DISPLAY);

String userNotificationEventId = ParamUtil.getString(actionRequest, "userEventId", StringPool.BLANK);
System.out.println("userEventIdin mark as read" + userEventId);

}