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

  • SEARCH
  • Home
  • 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 477281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:34:30+00:00 2026-05-13T00:34:30+00:00

I am trying to grab the last part of the current url: URL: http://example.com/test/action

  • 0

I am trying to grab the last part of the current url:

URL: http://example.com/test/action

I am trying to grab “action”.

The URL is always consistent in that structure. But it may have some extra params at the end.

This is in a rails app using the prototype framework. In rails it would be params[:id].

  • 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-05-13T00:34:31+00:00Added an answer on May 13, 2026 at 12:34 am

    You could simply use .split() on window.location.href, and grab the last entry.

    Example:

    var lastPart = window.location.href.split("/").pop();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to grab each URL parameter and display them from first to last,
Im trying to grab the LOC=URL from the following href http://url.comclickThrough?SRC=&target=SP&PN=1&FP=listings&T=Las+Vegas&S=NV&C=lawyer&PGID=yp604.8084.1349604581940.36701144470449&ALG=113&TS=nbt&OF=1&ACTION=log,red&CID=520623&LID=2325743402&TR=77&bidType=FLCLIK&relativePosition=3&position=33&PGSN=R1&RS=49.157852&CID=520623&FL=url&TL=off&LOC=http://www.nvtalaw.com How can i
I am trying to grab all the td elements between the first two that
I am trying to grab a row that has the max of some column.
I am trying to grab all the id's that are part_number and feed them
What I am trying to do is grab the last 4 person_id's and sum
I'm trying to grab the last space and what follows it on a line
I've been working on trying to write a function that will grab the POST
Trying to grab the numbers in front of (h), (w) and (d). These are
Im trying to grab the destination (dynamic) of a link (static) with php Im

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.