Using an Request Querystring in a external JS file

Posted on 2010-01-06
Last Modified: 2012-06-21

I have an ASP/VB page that loads an Javascript file i.e.


<script type="text/javascript" src="js/emaillist.js"></script>

But within the emaillist.js file I need a <%=Request.QueryString("userID")%>

How can this be used?

Question by:sanjshah12
    LVL 22

    Accepted Solution


    try this

    var mystr = "<%=Request.QueryString("userID")%>";
    <script type="text/javascript" src="js/emaillist.js"></script>

    in emaillist.js file, you can use 'mystr' variable which will return you the value of Request.QueryString("userID")..

    Author Comment

    Thanks neeraj that works great!

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
    This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now