Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Execute VB.NET Function from JavaScript Function

Status
Not open for further replies.

Mike555

Technical User
Feb 21, 2003
1,200
US
I'm trying to build a javascript function which executes an existing vb.net function in the current page. I can't find any examples of how to do this, so I'm totally stuck. Could someone please give me some advise on how to accomplish this?

Code:
<script language="JavaScript">
  window.onbeforeunload = BackToHTTP;
  function BackToHTTP()
  {
    [b]RUN VB.NET FUNCTION HERE[/b]
  }
</script>

Specifically, I'm trying run a function when the user exits the current webpage, using the preexisting javascript onbeforeunload function.

Thanks.
 
You can't do that. JavaScript is client side code. You cannot invoke server side code from there.
 
Sure you can, just use AJAX! :) It's all the rage!

Check this out:

All of the functions he uses on the page call server-side code without ever posting back.

Within Framework 2.0, there's also the concept of client callbacks, but it's not really as mature as some of the other third-party AJAX libraries (nor can you use it with Framework 1.*:

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top