Pass Server SCRIPT_NAME from page to server connect script

Hi there, me again...

I managed to get to use the server variable script_name ($_SERVER['SCRIPT_NAME']) in my workflow but that gets the path of the workflow, and I need the path of the page thayt calls the server action.

How can I:

  1. get the script_name from the page?
  2. pass that value to the server connect script?

Hope thats clear.

Thanks,
Jim

Hi Jim,

Are you using PHP? The answer depends on that information

P.S: I don't know the complete answer, I only know it depends

1 Like

Hi Apple, yes, I'm using PHP

You can view the "web server logs" output when a page is requested, when "debug" is on, to see all of the available Server variables available. It looks like the below picture. Just put $_SERVER in front of any of these variables like you did with SCRIPT_NAME.

Thnx GraybeardCoder, but my question was how to send this server variable from the page requested to the server connect script.

When a script is called via AJAX, it executes in the context of the backend server. So $_SERVER in PHP does not directly provide the URL of the page where the AJAX request originated.
You can create a GET variable in the server action and on the front end add the current URL using the data returned from the browser component.

1 Like

You'd be looking at something called server-side binding, you can search the forum, but make sure it's for PHP. That's how you inject server-side variables into a client-side web page.

I'd then create a variable on the front-end, and put the server-side binding expression inside the value attribute.

Thnx Teodor! I got that working

1 Like

Thnx Apple, I got it working from Teodors solution. Much easier that way I guess.