×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

VBScript FAQ

Microsoft Remote Scripting

Configuring client script to access the server with Remote Scripting by Swany
Posted: 5 Jul 01 (Edited 25 Apr 03)

This FAQ assumes that you have configured your server .ASP page to accept remote scripting calls.  There is another FAQ dedicated to that concept in the VBScript area.

I am also going to assume that your pages are in a subdirectory underneath the web root.  

For this FAQ we are going to assume the following directory structure:

/
/website
  |-backend.asp  --Remote scriptable ASP file
  |-frontend.htm --Client side script
/_scriptlibrary

backend.asp
------------------------------------
<%RSDispatch%>
<!--#include file="../_scriptlibrary/rs.asp"-->
<script language="javascript" runat="SERVER">
  var public_description = server_object;

  function server_object()
  {  this.TestFunction = testfunction;
  }

  function testfunction(text_to_bold)
  { return '<b>' + text_to_bold + '</b>';
  }
</script>


Ok..  So we have a backend.asp file configured to accept
remote scripting calls.

The first thing we need to do on the client side is to include the remote scripting java stub.

We do this with the line:
<script language=javascript src="../_scriptlibrary/rs.htm"></script>


This enables remote scripting on the client web page.

There are two methods by with ASP code can be called.  You can call it by invoking an ASP object, or by calling the methods on the ASP page individually.  

I generally prefer calling the methods individually and that is the method I am going to cover in this FAQ.

To execute a remote method, we use the RSExecute() function.

RSExecute returns a Call Object.  The Call Object is the means by which we get the status and result of a remote scripting call.

Lets create a client htm file

frontend.htm
--------------------------
<SCRIPT language=Javascript src="../_scriptlibrary/rs.htm">
</SCRIPT>

<script Language=javascript>
  function testSync()
    { text_to_bold = testtext.value;
      co = RSExecute("backend.asp","TestFunction",text_to_bold);
      alert(co.return_value);
    }
</script>
<input type="text" name="testtext" id="testtext">
<button onClick="testSync();">Test Me</button>


When you click the Test Me button, you should get a popup that says <b>Text in the text box</b>

That should get you started.  There are full examples in the remote scripting download that completely explain async calls and object calls.

Have fun.  

Back to VBScript FAQ Index
Back to VBScript Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close