Jquery isnt inputting some information into HTML doc

General Tech Bugs & Fixes 2 years ago

0 2 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (2)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

 

I have a search function as a part of an online booking webapp I am writing that is done via AJAX request, when the search request is executed, the php doc/server does respond with the correct information:

 class='hover'>
     class='files fileName'/> result1  
     class='owner files name green' >Available 

 class='hover'> 
     class='files fileName'/> result2  
     class='owner files name green' >Available 

 class='hover'> 
     class='files fileName'/> result3  
     class='owner files name green' >Available 

However, if I inspect element, I get this:

 class='hover'>
     class='files fileName'/> 
     class='owner files name green' >Available 

 class='hover'> 
     class='files fileName'/> 
     class='owner files name green' >Available 

 class='hover'> 
     class='files fileName'/> 
     class='owner files name green' >Available 

notice that in the second example, the second line for each  does not have a result in the 

my jquery code looks like this,

$("#table").empty(); //to empty the rable of default results
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200){
        $("#table").html(xhttp.responseText); //should put the new data into the table
        console.log(xhttp.responseText);
    }
}

why does jquery omit only those values? seems to precise to be random, but its in the middle of the string so that doesnt make any sense.

profilepic.png
manpreet 2 years ago

I now fixed the issue, this is how I did it.

TL;DR, I was stupid

I accidentally added a closing / to the end of my  so that it became td class='files fileName'/> which lead to complications.

thanks to user Ivar for pointing this out to me


0 views   0 shares

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.