Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
294 views
in Technique[技术] by (71.8m points)

javascript - Calling JS function from a CSHTML Script Tag, in another wwwroot/JS file

Apologies if this is a duplicate question. I have been trying to look for similar questions for the past few days. Would be grateful if you could guide me to the duplicate question.

Question- I am using a JS function inside a <script> tag in a view/CSHTML file. I am trying to execute that function from another wwwroot/JS file

Attempt I would try ordering the JS scripts such that I add script tag for the javascript(which has my function) before consuming ones, but as the consuming one is actually a library that is used in the javascript(which has my function)

I tried export function function_name(){ ... } and import { function_name} from "../../Views/Home/FileName.cshtml"; This was unsuccessful because of ECMAScript level incompatibilities.

question from:https://stackoverflow.com/questions/65924453/calling-js-function-from-a-cshtml-script-tag-in-another-wwwroot-js-file

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...