[dsp] Pass parameter from JS

Hi all,

got a problem while invoking a flow service from javascript:

test.dsp:

function test{

var result= someOtherFunction();

%scope param(cmr_id=result)%
%invoke test.services:myService%
%endinvoke%
%scope%
}

I want to pass the cmr_id parameter (it’s the myService input) with the value of “result”. Is that even possible?

Thanks in advance for all the help :wink:

Dude,

have you realized that when comes the time the JS runs, the page is in the browser (the client) and not in the “server” (where the IS service resides)?

Review what you want to accomplish, and verify whether your current approach is appropriate to get it.

I would recommed you to revise the ‘web programming model’…

Hmmmm… Dude,

yes, I am aware of it all. I hope you realized that it is possible to invoke flow services from JS because your post makes me think you haven’t :wink:

The question still stands, is it possible to add a var to the scope in this situation?

Yes, IS services can be invoked in DSP but:

  • The DSP tags are evaluated (e.g. the service is run) on the server when the client requests the page.
  • The JS within the page is not executed on the server.
  • The DSP tags are gone when the client gets the page.

You can invoke IS services from JS on the client but not using the DSP tags. You’d use other techniques for calling IS services from client-side JS.

One approach I’ve used is AJAX techniques to retrieve additional .dsp pages, passing URL parameters to the page which is in turn available to the IS service.