cancel
Showing results for 
Search instead for 
Did you mean: 

xsjs - Internal Server Error

Former Member
0 Kudos

I'm try to get my first xsjs to work

I have made it very simple.

var md = $.request.parameters.get('CALMONTH');

$.response.setBody("Procedure success!  CALMONTH = " + md);

$.response.setContentType("text/html");

$.response.setReturnCode($.net.http.OK);

But when it comes back

So even if i were to return something meaning full i wouldnt be able to use it.

Anybody knows what I might be missing.

Best Regards

Rasmus

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

That isn't the correct syntax for setting the HTTP status return code.  Here is the correct syntax:

     $.response.status = $.net.http.OK;

Your content type is also not correct.  It should be:

    $.response.contentType = 'text/plain';

You seem to be using an old syntax from the unreleased SPS4 version of the XSJS APIs.  This was changed before XSJS was released in SPS5.

Former Member
0 Kudos

Hi Thomas,

I tried to altering the code with your suggestions.

But still no luck.

It is definetly the line.

$.response.status = $.net.http.OK;

where we set the status that is the problem.

The "old" syntax as you say i got from the code completion, in SPS5.

Br Rasmus

Former Member
0 Kudos

I copied the code into another file. And then it worked.

So thanks.

Answers (0)