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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:31:06+00:00 2026-05-24T06:31:06+00:00

I have this Jquery line which finds the cell I would like to input

  • 0

I have this Jquery line which finds the cell I would like to input data into, This works when I use it outside of my $.post function (below), but not inside my $.post

$(this).parent().parent().find(".total_item_price").html("new text");

But when I use the above line in the below example, It does not work. It doesn’t update the text in the required field.

$.post(url, { "params": value}, function(data) {

          // This is where I am having a problem
          // also tried .text and .val
          $(this).parent().parent().find(".total_item_price").html(data.total_price_item);

          alert(data.total_price_item); // This outputs my data
       }, "JSON"); 

I basically want to put my returned (data) into the cell of the table. I don’t think that my table structure is the issue, but I can post it if needed.

I should add, that I have to find the parents and field, because each post function will output into a different cell, so its relative to where the user clicked.

Whats going wrong in this code?

  • 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-24T06:31:08+00:00Added an answer on May 24, 2026 at 6:31 am

    Because this inside your load callback is not equal to this outside of your load callback. They have different scopes.

    Before you call the post, cache the this from the other scope into a variable:

    var scope = this;
    

    And then in your callback you can reference the other this as scope:

    $(scope).parent().parent().find(".total_item_price").html(data.total_price_item);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a page of thumbnails with jQuery like this: ID=this.id; $('#thumbs').empty().html('<span class=title>'+$('#'+ID).html())+'</span><br />';
The following jQuery works fine in Firefox for me, but failed in IE6: $(<map></map>).attr(name,somevar).appendTo(#someElement);
I'm just starting to use the JQuery library so bear with me if I
I am currently learning jQuery, and I am curious about something. For functions that
I have a menu made with HTML, using a simple UL with lots of
I'm trying to call a jQuery popup window function from within an iframe. In
I have the following that will enumerate over the model and add an invoice
Don't be afraid to use any technical jargon or low-level explanations for things, please.
I am trying to find hidden element in a div using the attribute ends
For the last hour and a half I've trace Javascript calls in a Magento

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.