The path of the picture read from the database will be white when the page is refreshed for 8 times at a station made by node mongoskin.

  node.js, question

The path of the picture read from the database by a station made by node mongoskin will be white after the page is refreshed for 8 times. I don’t know how it is caused.

<html>
 <head>
 <title>Test</title>
 <meta charset="utf-8">
 <link rel="stylesheet" type="text/css" href="/files/style/index.css" >
 <script src="/files/js/jquery1.72.js"></script>
 <script>
 
 window.addEventListener('load',function() {
 
 
 var UrlUl = document.getElementById('ProductUl');
 $.getJSON('/comment/img', function (result) {
 if(result.code !  == 0){
 return alert('NO');
 bracket
 
 for(var i = 0;   i < result.comments.length;  I plus)
 var oimgLi = document.createElement('li');
 oimgLi.innerHTML = '<a href="/files/Comment.html?  P_id=' plus result.comments[i].p_id plus' > < imgmsrc = "/files/'plus result.comments[i].url plus'. jpg"></a><h3 >' plus result.comments[i].con plus' < /h3 >';
 UrlUl.insertBefore(oimgLi);
 bracket
 });
 
 
 },false);
 </script>
 </head>
 <body>
 <ul class="ProductUl" id="ProductUl">
 <!  --
 <li>
 <a href="#"><img src="img/1.jpg"></a>
 < h3 > Curtilage's goddess < /h3 >
 </li>
 -->
 </ul>
 </body>
 </html>

This is the foreground code
Background code

handler['/comment/img']=function(req, res){
 mongo.db('localhost:27017/test')
 .collection('imgURL')
 .find({}).toArray(function (err, result) {
 if(err) {
 res.end(JSON.stringify({code:1}));
 }else{
 res.end(JSON.stringify({code:0,comments:result}));
 bracket
 });
 bracket

This is the routing code

Pictures are static resources, so there are only three possibilities:

  1. There is a problem with the DOM tree during insertion.
  2. There is a problem with the static file service.
  3. There is a problem with the picture data interface.

So check these contents:

  1. Use the browser debugger to check whether the picture link and DOM are normal during rendering, and if so, check whether the static file service is stable.
  2. Check whether the server-side interface is stable, and debug if it is unstable.