Home >Web Front-end >JS Tutorial >How to pass JS variable value to ASP variable_javascript skills
As the main page, asp is connected to a js. I want to know if I can call the variable values of asp in js. If so, how are these values passed?
This is what I did. Is it correct? Here in asp: And on the js side: location.href= 'lmsg.asp?id=<%=trim(request("jsid"))%>';The result of this is that the obtained asp variable is not used at all!
The best way is to set up a script code block in asp and use <%%> to assign the value. You cannot use <%%> in js files because the asp parser does not parse js files. As follows:
HTML code: