Search Search

#1 worldwide
FREE Coding Lessons

since 1996
   THE BEST WAY to learn ASP & Asp.net!
Advertise Here!
click for details
Credits Host:
DiscountASP.net
Server Admin:
The "Team"
Contact Info.
Charles M. Carroll

my Blog
[prev. Lesson]  Server Perlscript: Resources
     [next Lesson]  Remote Scripting Listbox

Remote Scripting Basics by Charles Carroll

Remote Scripting is a magical, infinitely powerful Javascript client library that allows:

  • Javascript in an HTML or ASP page to call an ASP subroutine on the server to fetch data

  • dynamic page construction via Javascript that could be for example fetching database data for a page without reloading the page.

The main limitations are

  •  the browser must be a 4.x browser

  • It doesn't work on IE Mac (thanks to "Brad Rhoads" <brad@data-science.com> for that tip)

The current version requires 3 files: rs.asp, rs.htm and rsprox.class which can be downloaded from http://msdn.microsoft.com/scripting on the server to work and their exact path must be set in the files (/learn/test/remote/ is the path in these samples).

Our sample remote1.htm looks like this:

   filename=/learn/test/remote1.htm

<Test Script Below>


<HTML><HEAD><TITLE>remote1.htm</TITLE></HEAD>
<BODY onload="handleRSExecute()">
<script language="JavaScript" src="/learn/test/remote/rs.htm"></script>
<script language="JavaScript">RSEnableRemoteScripting("/learn/test/remote/");</script>
<h2>Simple Remote Scripting Example</h2>
<form name="remote1">
The Test <input type="text" name="test" value="none"><br>
<SCRIPT LANGUAGE="javascript">
    var serverURL = "remote1.asp";

    function myCallBack(co)
    {
        // document.write (co.return_value);
        remote1.test.value=co.return_value;
    } 

    function handleRSExecute()
    {
    var co = RSExecute(serverURL,"Method3");
    myCallBack(co);
    }
</SCRIPT>
</form>
</HTML>

Our sample remote1.asp looks like this:

   filename=/learn/test/remote1.asp

<Test Script Below>


<%@ LANGUAGE=VBSCRIPT %>
<% RSDispatch %>
<!--#INCLUDE VIRTUAL="/learn/test/remote/rs.asp"-->
<SCRIPT RUNAT=SERVER Language=javascript>
    function Description()
    { 
        this.Method1 = Method1;
        this.Method2 = Method2;
        this.Method3 = Method3;
    }
    public_description = new Description();

    function Method1()
    {
        return "method1";
    }
    
    function Method2()
    {
        return "method2";
    }

    function Method3()
    {
        return "method3";
    }
    
</script>


Chaz Wish List
Tall Tip $5
Grande Tip $20
Venti Tip $39
Tip Jar Thanks
2004 Thanks
2005 Thanks
HUGE Tip -love site