I’m a Business Intelligence guy slowly and painfully getting re-ramped on web-dev. Haven’t really touched this stuff since .NET was first released by Microsoft.
Anyhow – runat=”server”: Back when I used this stuff, this sucker would allow me to address whatever element I tagged with this in my server-side C#/VB.NET/Whatever. Fine:
<div>
<iframe runat="server" id="Iframe2" src ="foo.com"></iframe>
</div>
I’ve been spending the lion’s share of my learning time outside of the Microsoft stack – and I’m curious if runat=”server” is still used outside the ASP.NET/IIS world.
For example, if I have some JavaScript code ala:
<script>
$.post("http://foo.com/somePage", {
someInfo: "russell",
otherInfo: "hoohaw"
}, function(response) {
Foo(response);
});
</script>
…could I stick runas=”server” into the <script> tag? Would this cause the script to run server side? (I’m guessing “no” – I’d just have a script block that could be accessed by server-side code?)
Does runas=”server” have any utility outside of the ASP.NET/IIS world? I’ve been getting familiar with LAMP, and I’m curious if runas=”server” might make my client-side code run on the server — kinda like PHP or something.
Javascript is a client-side language. It means it’s executed in the browser.
When the browser receives the HTML page with the javascript in it, it executes it.
So, no, there is no way for ASP.NET to execute your javascript code.
runat="server"is only used in ASP.NET AFAIK.Also, PHP doesn’t execute javascript code either.
I think you should review your client-server model 🙂 (PHP/ASP.NET is server, browser is client, and javascript is executed by the browser only).
PS: when I say “javascript is executed by the browser only”, I’m not talking about node.js or any JS server-side technology of course.