• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

187
Views
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>
about 3 years ago · Santiago Trujillo
2 answers
Answer question

0

Curtesy of @MarkRobson : remove # on html ->

about 3 years ago · Santiago Trujillo Report

0

Looks like it’s just a typo.

You have:

It should be:

about 3 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error