'Ajax receives response as should but does not show on page

I need to figure out something with AJAX , express and Node.

  • my Ajax request receives data and logs suggest that they are there
  • they are not showing on the page

Here are the functions : Ajax request :

let openSingle = async function (par) {
    $.ajax({
        url: targetEnvironment + '/v1/flashmsg/' + par,
        dataType: 'json',
        type: 'get',
        data: JSON.stringify(par),
        beforeSend: function (xhr) {
            xhr.setRequestHeader("x-access-token", localStorage.getItem('token'));
        },
        contentType: 'application/json',
        success: function (data, textStatus, jQxhr) {
            console.log("Row <" + JSON.stringify(data)+ "> data retrieved successfully"); //shows ok
          $("#par").html("<b>displayed data is</b>" + JSON.stringify(data)); 
        },
        error: function (jqXhr, textStatus, errorThrown) {
            switch (jqXhr.status) {
                case 401:
                    document.location.href = "/index.html";
                    break;
            }
        }
    });
};

HTML (problem at h5 -> line 13)

<div class="modal fade" id="parModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
  aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="parTitle"></h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <form role="form">
        <div class="modal-body">
          <h5 id=#par></h5>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
          <button type="submit" class="btn btn-primary" id="saveAstreinteNum">Save</button>
        </div>
      </form>
    </div>
  </div>
</div>


Solution 1:[1]

Curtesy of @MarkRobson : remove # on html ->

Solution 2:[2]

Looks like it’s just a typo.

You have:

It should be:

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 RomanSmoll
Solution 2 Mark Robson