on 07-04-2013 6:13 AM
Hi All,
I am facing trouble when I am running the below server side javascript multiply program:"Func.xsjs".
I get the error as "An error occurred during the processing of your request.
Data might be lost". Please guide me where I am wrong . Thanks a lot for your time.
Func.xsjs
function performMultiply()
{
var body = '';
var num1 = $.request.getParameter('num1');
var num2 = $.request.getParameter('num2');
var answer;
answer = num1*num2;
body = answer.toString();
$.response.addBody(body);
$.response.setReturnCode($.net.http.OK);
}
var aCmd = $.getParameter('cmd');
switch(aCmd)
{
case "Multiply": performMultiply();
break;
default:
$.response.setReturnCode($.net.http.INTERNAL_SERVER_ERROR);
$.response.addBody("Invalid Choice" +aCmd);
}
Hi Uma,
It has certain incorrect points in your script.
1. please change $.response.addBody(body); to $.response.setBody(body);
2. please change $.getParameter('cmd'); to $.request.getParameter('cmd');
3. please add context type such as $.response.contentType = 'text/plain';
Hope this can help you.
Regards,
Jerry
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.