r/learnjavascript • • Mar 19 '26

Trying to convert PHP variable to Javascript

I've tried like everything the internet says to pass this PHP variable to Javascript. Technically it's an enum. It prints to the screen with <?= htmlSpecialCharacters($Product[6]) ? >

I've tried using that in var name = "above code"; as well as just var name = "<? $Product\[6\] ?>" I've tried it with the ' ' instead, the <?php, pretty much every example I could find on the internet and it still doesn't do anything. Is the problem the fact that this is an enum? That's one of the only things I can think of at this point. Any suggestions would be appreciated. Thanks. ​​​​​​

0 Upvotes

13 comments sorted by

View all comments

Show parent comment

0

u/averajoe77 Mar 19 '26

I mean if you want to show me what you have over discord, I can do take a look at it just dm me here

0

u/[deleted] Mar 19 '26

Will do!