Hi,
Within my experience, this is the only way that I've seen to run a JS code, in the Action function of an item.
It is a called event in the report. I've not found other way to run the JavaScript in SSRS to work like AJAX function.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am trying to create a custom function that would do an AJAX call.
Here is the function:
Public Function getImage(ByVal s As String) As String
Dim objHTTP = CreateObject("XMLHttpRequest")
'Dim URL = "http://www.somedomain.com"
'objHTTP.Open("POST", URL)
'objHTTP.send("")
End Function
I call this function in a textbox expression like this:
=Code.getImage("123")
I am getting #error in place of the textbox while running it in the Builder and on the server. If I comment all code in the function then no error.
Any idea how to fix it?
Thanks
Hi,
Within my experience, this is the only way that I've seen to run a JS code, in the Action function of an item.
It is a called event in the report. I've not found other way to run the JavaScript in SSRS to work like AJAX function.
Hi,
The AJAX function won't working, because that the custom code is "seen" and processed in SSRS server.
The browser only received the processed data , and present it.
For example, I add some code in the report to do some string operation.
The browser could only receive the processed results see:
It is only a div, no code being passed to the browser.
AJAX code spinet need to be placed in the script session of the HTML page before the web page being rendered by the browser.
This is why it is not working in SSRS.
There is no work around for this , if we only place the code in report Custom Code session.
Regards,
Lukas
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
What can I do if my transaction log is full?--- Hot issues November
How to convert Profiler trace into a SQL Server table -- Hot issues November
So, if I add a function to the ReportViewer.aspx I can use it in my report?
Hi,
It is not suggested to change the official web portal of SSRS. I've not personally tried this, I am afraid this would not work neither.
Also, even if we add it to the web portal it will change the site behavior for all reports.
I am using this as a textbox expression:
It's not working. The same code only works when it's used in Action.
Any other idea how to run JS code when a report is running?