Jump to content

How can i call a JS function file that i previously added on ServerModule?


Rafael P

Recommended Posts

Hi everyone!

I just made a file using JS Script and added on ServerModule and saved the file inside my project. How can i call this file on my application in OnClick Event in a button? 

For example, this function has to be activated when a button is clicked.

I already tried UniSession.AddJS(), but unfortunately was unsuccessfully.

Link to comment
Share on other sites

8 minutes ago, Sherzod said:

Hello, 

How?

Hi Sherzod!

So, i saved the js script file inside my deploy achieves from my project: Deploy/Application/JS/Google_script.js and submitted on ServerModule -> CustomFiles.

Now i want to call this file when a button on my application is clicked.

Thank you!

Link to comment
Share on other sites

38 minutes ago, Rafael P said:

i saved the js script file inside my deploy achieves from my project: Deploy/Application/JS/Google_script.js and submitted on ServerModule -> CustomFiles.

If the file is located in the web directory, and after including it in CutomFiles, if the file contains a running script, then it will already run.

Link to comment
Share on other sites

4 minutes ago, Sherzod said:

If the file is located in the web directory, and after including it in CutomFiles, if the file contains a running script, then it will already run.

I think i will need to specify more details from my project.

First, this script was provided by Google and all he have to do is capture many of people who access our website and register on it, so he can help us to know where we can put our efforts in publicity, gain access, etc... it's a Marketing tool.

And the instructions is telling us to put this script right after user click on register or confirm button. 

But i can't see a easy way to implement this...  it was supposed to be something trivial but it wasn't until now... 

Link to comment
Share on other sites

44 minutes ago, Sherzod said:

No problem.

Where is the instruction?

We had a online meeting with some people from Marketing of Google, and that was all they said. There is no documentation on how it should be done, it was just said during the conversation

Link to comment
Share on other sites

@Rafael P

O que o Sherzod está lhe pedindo é que vc anexe o script js e poste aqui o link do Google onde vc o baixou.

melhor ainda seria vc criar um projeto limpo, adicionar o script( pra simular o que vc quer ) que vc tem e enviar esse projeto.

 

what Sherzod is asking is that you attach the js script and post here the Google link where you downloaded it.

even better would be for you to create a clean project, add the script (to simulate what you want) that you have and send this project.

Link to comment
Share on other sites

1 hour ago, mikromundo said:

@Rafael P

O que o Sherzod está lhe pedindo é que vc anexe o script js e poste aqui o link do Google onde vc o baixou.

melhor ainda seria vc criar um projeto limpo, adicionar o script( pra simular o que vc quer ) que vc tem e enviar esse projeto.

 

what Sherzod is asking is that you attach the js script and post here the Google link where you downloaded it.

even better would be for you to create a clean project, add the script (to simulate what you want) that you have and send this project.

Opa amigo, então eu havia adicionado o link mas apaguei depois da resposta dele. É pra colocar esse script após o confirm do botão, só que não faço ideia de como colocá-lo porque é de uma ferramenta de analytics de marketing do Google. Nos foi dado durante uma reunião e chegou até mim somente dessa forma. Então não sei se isso é realmente possível. 

Link to comment
Share on other sites

I guess you can store the script in a text file, load it into a stringlist as the application starts, 

and then run the script using AddJS when you need it, like in the event handler of a button.

In mainForm.Create:

  sl:=TStringList.Create;

  sl.loadFromFile('myjs.js');

In onClick event handler:

  AddJS(sl.text);

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...