How to use javascript to communicate with backend code?
Is it possible to use javascript on a web page to get information from
backend code written in C#?
If this is possible, can I please be provided with some links or searching
terms for my learning? The person I am doing this for wants a straight up
HTML5 page (plus C# backend code), meaning not using ASP.NET models or
having things on .aspx pages, etc. I am by no means a web developer, but I
am really not sure this is possible.
Example of something I might need to do:
// C# code
class BackendProgram {
void backendUpdateWebpage() { // might return a bool instead
// does some calculation to decide if
// element "ShowAndHide" should be visible or not
}
}
...
<!--HTML/Javascript-->
<script>
function updateVisibility() {
// contacts backend code
// sets "ShowAndHide" visibility to "none" or
// block/inline depending on result from backend
}
</script>
<div id="ShowAndHide">
<p>This is an element.<p>
</div>
<script>updateVisibility();</script>
No comments:
Post a Comment