Hi all!
Is there an example to send JSON data to server using RPC?
Is there an example to send JSON data to server using RPC?
isc.DynamicForm.create({
ID:"output",
width:600,
fields:[
{name:"outputText", title:"SessionID", type:"text"},
{name:"submitBtn", title:"Click Me", type:"button", click:"handleSubmitBtnClick();"}
]
});
function handleSubmitBtnClick() {
isc.RestDataSource.create({
ID:"getSysType",
dataFormat:"json",
dataTransport:"xmlHttpRequest",
operationBindings:[
{operationType:"fetch", dataURL:"/rest/request/"+session, dataProtocol:"postParams"}
],
transformRequest: function (dsRequest) {
dsRequest.contentType = "application/json";
dsRequest.httpMethod = "POST";
dsRequest.httpHeaders = { "Accept" : "application/json" };
var params = {
"call" : "SysInfo_getInfo",
"params" : {
"name" : "info.system.type"
}
}
return isc.addProperties({}, dsRequest.data, params);
},
transformResponse: function (dsResponse, dsRequest, data) {
if ( data["_rv"] == 0 )
{
alert("value:"+data);
}
}
});
isc.RestDataSource.get("getSysType").fetchData(null, getSysTypeHandler);
}
function getSysTypeHandler(data)
{
alert("GetSysTypeHandler:"+data);
}
Comment