locked
Jquery ajax RRS feed

  • Question

  • User1390323494 posted

    I've a table on the change of which , I'm making an ajax call. I need to set the value from the success result of the ajax call to a td value of the tabe.

    I'm referencing the td as var  abc = $(this).closest.('tr').find('.classNameOf-td').val();

    To this abc, I'm setting the value fro the result as abc = result.value();.

    I gave an alert and seeing the value in the alertbox. But it doesn't get set to the label in the td and doesn't get displayed on the form.

    Any suggestions as to how to make it wotk?

    Sunday, August 2, 2020 3:01 PM

All replies

  • User475983607 posted

    I've a table on the change of which , I'm making an ajax call. I need to set the value from the success result of the ajax call to a td value of the tabe.

    I'm referencing the td as var  abc = $(this).closest.('tr').find('.classNameOf-td').val();

    To this abc, I'm setting the value fro the result as abc = result.value();.

    I gave an alert and seeing the value in the alertbox. But it doesn't get set to the label in the td and doesn't get displayed on the form.

    Any suggestions as to how to make it wotk?

    The community cannot see the markup which makes it tough to validate the code.  I assume you need to read the text or html from the selector.  The .val() function is used to read inputs.  See the jQuery reference documentation for the proper syntax.

    $(this).closest.('tr').find('.classNameOf-td').text();
    $(this).closest.('tr').find('.classNameOf-td').html();

    https://api.jquery.com/text/

    https://api.jquery.com/html/

    https://api.jquery.com/val/

    Sunday, August 2, 2020 3:09 PM
  • User1390323494 posted

    Thank you, appreciate your help. I did try those but am not getting empty value back when I use .text() or .html().

    I agree, it is hard to tell without seeing the markup. Will try posting the markup

    Sunday, August 2, 2020 7:41 PM