Javascript 如何从HTML到Suitescript获取价值?
我正在SuiteScript2.0中编写一个suitelet,其中包含一个html部分。我需要从html表单中获取suitelet中变量的值Javascript 如何从HTML到Suitescript获取价值?,javascript,html,netsuite,Javascript,Html,Netsuite,我正在SuiteScript2.0中编写一个suitelet,其中包含一个html部分。我需要从html表单中获取suitelet中变量的值 /** * @NApiVersion 2.x * @NScriptType Suitelet */ define([ 'N/http', 'N/email', 'N/record' ,'N/runtime'], function(http, email, record,runtime) { function onRe
/**
* @NApiVersion 2.x
* @NScriptType Suitelet
*/
define([ 'N/http', 'N/email', 'N/record' ,'N/runtime'],
function(http, email, record,runtime) {
function onRequest(context) {
function sendGetRequest() {
var param= http.get({
url : ''
});
var html = '<html><body>something: '
+ something
+ '<br/>'
+'<form method="post">Input <input type="text" name="something" id="something" value=""/> <input type="submit"/> </form></body></html>';
log.debug({title : 'param', details : param});
context.response.write(html);
var something = html.getParameter('something');
log.debug({title : 'something', details : something});
}
sendGetRequest();
}
return {
onRequest: onRequest
};
});
/**
*@NApiVersion 2.x
*@NScriptType Suitelet
*/
定义(['N/http','N/email','N/record','N/runtime'],
函数(http、电子邮件、记录、运行时){
函数onRequest(上下文){
函数sendGetRequest(){
var param=http.get({
url:“”
});
var html='something:'
+某物
+“
”
+"输入";;
debug({title:'param',details:param});
context.response.write(html);
var something=html.getParameter('something');
debug({title:'something',details:something});
}
sendGetRequest();
}
返回{
onRequest:onRequest
};
});
Suitelet上的所有内容都在上下文对象上,如果需要特定的HTML数据,必须使用客户端脚本将其放入其中一个表单字段中