javascript - Script works on xampp but not on host server -


the script supposed display posts , images user. works on xampp on host server see posts not images user has posted. blank. on network tab cannot seen either. here script part:

var post = function(url){ $('#apost').show(); $('#apost').html('<i class="fa fa-circle-o-notch fa-spin afo"></i>');  $.ajax({     type: 'get',     url: url,      success: function(data){         var template = $("#itemtemplate").html();         var result101 = mustache.render(template, jquery.parsejson(data));         $(".post-content").html(result101);         $('#apost').hide();     },     complete: function(){         setinterval(post('ajax/post?page='+pagenum), 30000);      },      error:function(){         $('.don').html('error loading post');     } });         }; 

here html part:

     <div class="media-content">                 <div>{{post}}</div>                 {{#is_photo}}                 <img src="uploads/scaled/{{photo44}}" alt="{{username}}" />                 <p>{{caption}}</p>                 {{/is_photo}}             </div> 

you need provide path accessible host server. host server sees localhost path , if directory tree of images not same local server, expected behaviour because there nothing inside host server's local path.

two ways:

  1. create exact same path in host server , put images there.
  2. apply relative path specifications (don't use localhost.../...), instead, images place this: static.yourproject.com/images/xyz.png

Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -