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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:56:47+00:00 2026-05-28T02:56:47+00:00

This is my method: $(document).ready(function () { $(‘td.clickableCell’).click(function () { var currentObject = null;

  • 0

This is my method:

$(document).ready(function () {
    $('td.clickableCell').click(function () {
        var currentObject = null; 
        currentObject = $(this).text();
        @Html.ActionLink("GetThis", "Get", new {theName = currentObject} )
    });
});

but it says that currentObject doesn’t exist in the current context. How to resolve this?

  • 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-28T02:56:47+00:00Added an answer on May 28, 2026 at 2:56 am

    Instead of @Html.ActionLink you should use the jQuery.get function. `@Html.ActionLink is run on the server whereas the javascript is run on the client.

    $(document).ready(function () {
        $('td.clickableCell').click(function () {
            var currentObject = $(this).text();
            $.get('@Url.Action("GetThis", "Get")', {theName : currentObject});
        });
    });
    

    The Url.Action is rendered on the server and will give you the appropriate url. The $.get will run a get request on the client.

    Keep in mind, if this javascript is in a .js file, the Url.Action will not be run. In that case you may simply want to replace it with /Get/GetThis or render the url in a hidden field on the page and get the value of the hidden field in your .js file.

    You need an action method that looks like this in order to access the parameter:

    public ActionResult GetThis(string theName)
    {
        // manipulate theName
        return View();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to find the jQuery equivalent of this JavaScript method call: document.addEventListener('click', select_element,
I'm wiring the following method to my document.ready function. However, the myAutoCompleteURL.aspx URL is
This code results in an error at second line ($('boxes div.box')) <script type=text/javascript> $(document).ready(function
I have this for loop in jquery $(document).ready(function() { for(i=0; i<counter; i++) { dataCounter
Basically I want to do something like this: $(document).ready(function() { if ($(body).attr(class) === HomePage)
I have this method on a webpart: private IFilterData _filterData = null; [ConnectionConsumer(Filter Data
Should I be using this method of throwing errors: if (isset($this->dbfields[$var])) { return $this->dbfields[$var];
Hi have a jquery dialog: the js source is: $(document).ready(function() { $(#DialogConfirmationDiv).dialog({ bgiframe: true,
Firstly, is there a way to use document.write() inside of JQuery's $(document).ready() method? If
I have the next code: $(document).ready(function () { $('#imgone').hide().delay(500).fadeIn(1000).delay(4500).fadeOut(500); $('#imgtwo').hide().delay(1500).fadeIn(1000).delay(3500).fadeOut(500); $('#imgthree').hide().delay(2500).fadeIn(1000).delay(2500).fadeOut(500); }); It's more

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.