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 9128655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:33:59+00:00 2026-06-17T07:33:59+00:00

I have an ASP.NET MVC4 application that is using jQuery to make some calls

  • 0

I have an ASP.NET MVC4 application that is using jQuery to make some calls to a WebApi controller in the same project. Passing an ID to the controller, /MyController/123 should display different data when the page is loaded. The problem is that I don’t know how to get that ID passed to jQuery. It’s not a query string parameter per se, so this won’t work. What I want is the “123” from the URL. Is there a common/standard way to do this short of just chopping up the URL?

  • 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-17T07:34:01+00:00Added an answer on June 17, 2026 at 7:34 am

    you can either put it in a ViewBag object in the controller, ViewBag.PassedId = Id, and then on the front end use the razor or whatever view engine method to place it into a javascript variable,

    <script>
    var id = @(ViewBag.PassedId);
    </script>
    

    Or you can attach it to a hidden form element and grab the value there. But you would tie an object model to pass from the controller.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have ASP.NET MVC 4 application that contains library of some simple jQuery widgets.
I have an asp.net MVC4 application that I am using Unity as my IoC.
I have a layered web application that I built with ASP.NET MVC 4, WebAPI
I have been writing an application using ASP.Net MVC4, where the majority of the
I have a problem that I suppose comes from my ASP.NET MVC project using
I have a web site built using ASP.NET MVC4 that I can publish fine
I have created a Single Page Application (ASP.NET MVC4) using Steven Sanderson's instructions .
I have created a sample project using ASP.NET MVC 3 Web Application (Razor) template.
I have asp.net mvc 4 web application project on my server in IIS Directory.
I have a simple asp.net MVC4 / EF 4.1 project created with VS 2011,

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.