Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8458151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:00:04+00:00 2026-06-10T13:00:04+00:00

I wish to pass a request parameter to the JavaScript that is to be

  • 0

I wish to pass a request parameter to the JavaScript that is to be loaded. This parameter can then be used as a constant within the script.

One example of this is how fancybox 2.x requres a v=2.1.0 parameter as defined in the instructions.

Searching through the fancybox source I could not identify how this gets used, it’s required for both the CSS and JavaScript.

My main requirement for this is to be able to pass in an application context path to the JS which handles ReST requests.

<script type="text/javascript"
        src="<c:url value="/js/rest.js?ctx=${pageContext.request['contextPath']}"/>"></script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T13:00:07+00:00Added an answer on June 10, 2026 at 1:00 pm

    First you have to identify the script (you can give a script tag an id). Scripts are in the document.scripts nodelist. Then you take the src attribute of it (a string), split it on the question mark and take the second element of the resulting array. That can be processed further.

    Something like:

    var script = document.scripts[0]
       ,params = script.src.split('?')[1].split('&')
       ,paramsObj = {};
    
    for (var i=0;i<params.length;i+=1){
      var keyvalue = params[i].split('=');
      paramsObj[keyvalue[0]] = keyvalue[1];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web service that wish to call, and I want to pass
I have a QuerySet that I wish to pass to a generic view for
i wish to pass 2 value to invoke my script but i failed to
I have a list of numbers I wish to bind or pass to this
I wish to pass FromDate and ToDate into a procedure and then update and
I wish to pass many small PNG files as base64 encoded URIs within an
I wish to pass Null Value to the parameter as follow: _db.AddInParameter(dbCommand, Id, DBNull.Value
I wish to write a macro, to be used within any method, which references
I wish to pass some data to the delegate method, of a Process object,
I wish to pass to Hibernate's SessionFactory hibernate.hbm2ddl.auto=update and see in log file generated

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.