www.webdeveloper.com
Results 1 to 15 of 19

Thread: ASP and JavaScript

Threaded View

  1. #1
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    5,298

    ASP and JavaScript

    A direct relationship between the two is simply non-existant. Both technologies were developed by seperate companies which have relatively nothing to do with each other.

    JavaScript, a product of Netscape, was developed to allow web programmers to write applications which could interact with web browsers. Whilst Active Server Pages, on the other hand, was developed to allow programmers to create data driven websites.
    ASP, as the name implies, is a server-side technology framework (really just a collection of objects, which are interacted with via one of two languages; VBScript or JScript). This fact alone forbids ASP from directly communicating with JavaScript.
    Infact, an ASP script will be completely executed and forgotten about by the time the page is even downloaded and displayed on the users screen.

    When a user requests a page, say 'category.asp', the browser will request the page from the server. Once the page has been located, the source code will be processed on the server and, if necessary, HTML code will be output and displayed to the user. With that said, it should now sound completely illogical to assign a JS variable to an ASP script without first sending the data to the server for processing.

    I am aware of the indirect ways which ASP can influence Javascript. Such as; setting Javascript variables from the server. The following is a simple example:

    Code:
    <%
    dim x 
    x = 2
    
    response.write("<script>var x = " & x & ";</script>")
    %>
    The preceding ASP script simply defines a variable named 'x' and then prints its value to the output. This method actually doesnt show any evidence of ASP and JavaScript communicating.

    Some people will say "But you can use JavaScript to write ASP scripts". This actually isnt true. You can use a spawn of JS call JScript. JScript was also developed by Microsoft and is used for both client side and server side scripting. When using JScript in an ASP application, you would not refer to it as JS, but as ASP, none the less.

    Regards,
    Andrew Buntine.
    Last edited by buntine; 03-09-2005 at 11:22 PM.
    Share on Google+

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles