LiveASP - Calling ASP Code from Javascript

ASPajax has a feature which allows you to call any ASP server function from client JavaScript: LiveASP.

The results of ASP functions - or their output HTML are also returned to javascript!

This process is straightforward, and can be explored by examining the example file HelloLiveASP.asp and the object reference.

How to develop using LiveASP

  • In ASP - use the ASPAjax.EnableLiveASP function to permit ASPajax access to any ASP function.
  • In JavaScript - ASPAjax.LiveASP function to call the above ASP function. The return results can be sent to a callback function.

Start Programming with LiveASP

<!--#include file="aspajax.asp"-->
<%
ASPAjax.EnableLiveASP("HelloWorld") ' Registers function for LiveASP
ASPAjax.Open()

function HelloWorld()
HelloWorld = "This HelloWorld was returned from ASP."
end function
%>
<input type="button" value="Try LiveASP" onclick="testLiveASP()" />

<script type="text/javascript"> testLiveASP= function(){
ASPAjax.LiveASP("HelloWorld", fnCallback )
}
fnCallback = function(result){
alert(result);
}
</script>

<%
ASPAjax.Close()
%>

You can pass integer and string parameters into ASP functions - and the returned result or output HTML is sent to a callback function.

You may also set an UpdatePanel's id or DOM element as the callback object - and the result HTML from the ASP function will be written inside.

ASPajax pro

LiveASP is available for ASPajax professional users only. However on localhost and local servers - LiveASP will work for development purposes.

Object Reference

Examples of ASPajax LiveASP