hi guys i have a variable declare in js form and has a value , the only problem is I want that variable to be used in image tag source in the asp mvc view. how can I pass that variable to asp?
hi guys i have a variable declare in js form and has a value , the only problem is I want that variable to be used in image tag source in the asp mvc view. how can I pass that variable to asp?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Muhammad Imran AnsariPosted Feb 13, 2022, 6:50 PM
Another way is take a hidden variable that hold the value from the javascript
and accessing it on your MVC view. It should work.
Javascript:
document.getElementById('myImageName').value = "image.jpg";
OR you can achive with the following code:
Ramon OrtegaPosted Feb 14, 2022, 2:46 PM
Sachin SinghPosted Feb 13, 2022, 6:35 PM