如何在serveresource方法中捕获Alloy ui io请求发送的数据? [英] how to capture the data sent by alloy ui io request in serveresource method?
本文介绍了如何在serveresource方法中捕获Alloy ui io请求发送的数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在serveResource方法中获取标题和描述的空白值.这是从io请求发送参数的正确方法吗?
Getting blank values for title and description in serveResource method.Is this the right way to send the parameters from io request?
在数据库中插入空白值后,我必须重新加载页面以查看插入的值?所以io-request不是ajax请求吗?
After inserting blank values in database I have to reload the page to see the inserted values?So io-request is not ajax request?
<aui:script use="aui-base">
A.one('#<portlet:namespace/>save').on('click', function(event) {
var A = AUI();
var title=A.one('#<portlet:namespace/>title').val();
alert(title);
var description=A.one('#<portlet:namespace/>description');
var url = '<%= newJob.toString() %>';
A.io.request(
url,
{
method:'POST',
data: {
<portlet:namespace />title: title,
<portlet:namespace />description: description,
},
}
['aui-io-deprecated']
);
Liferay.Util.getOpener().<portlet:namespace/>closePopup('<portlet:namespace/>dialog');
});
推荐答案
AUI的io请求仅是ajax请求.
AUI's io request is ajax request only.
您可以使用以下代码在serveResource方法中获取参数:
You can get parameters in serveResource method using code below:
ParamUtil.get(resourceRequest, "NAMEOFPARAMETER");
修改您的javascript函数并提供数据属性,如下所示:
Modify your javascript function and provide data attribute as below:
data: {
'<portlet:namespace />title': title,
'<portlet:namespace />description': description,
}
这篇关于如何在serveresource方法中捕获Alloy ui io请求发送的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文