How to access the arrays of strings inside – Biku7 Nov 03 '20 at 21:38

  • Can't you set the string, instead of the array, in the script and then split it in the client? – Emiel Zuurbier Nov 03 '20 at 21:52
  • Here, I have take the 3 strings as an example just to show the function. In actual the array of string varies. It can be of 3 array strings or 2 or 1 or maybe 4. So hence can't decide how many to split each time and then send to the script. I hope you got it what I am saying here. @EmielZuurbier – Biku7 Nov 03 '20 at 22:00
  • What is an Array to your template is not an Array once it is rendered into a JavaScript block. I would expect this code to output: `alert(Buyers,Sellers,Investors);`, and because you don't have a variable named "Buyers" (or "Sellers" or "Investors") you should get a ReferenceError. – 76484 Nov 04 '20 at 00:42
  • @76484 I am not getting any alert. I just want to know how I can access that array into script of handlebar page. Tell me that. – Biku7 Nov 04 '20 at 06:03
  • It would help a lot if you would show how the array is being output to your script in the template. What does it look like? – Emiel Zuurbier Nov 04 '20 at 08:46
  • 1
    @Biku7: I am trying to help you understand what your problem is. Using the developer console to identify the Error would be a good start. Next, you need to understand which JavaScript is executed on the server and which is executed on the client and that the two are not a single environment and they cannot just call each other's variables. Variants of your question have been asked before. See: https://stackoverflow.com/q/64407740/3397771 – 76484 Nov 04 '20 at 11:58
  • 0 Answers0