M
M
Maxim2015-02-03 16:43:02
Android
Maxim, 2015-02-03 16:43:02

How to display a photo in the application?

I am making an application in which it is necessary to display some of the information and photos loaded from the server via ajax. I get information through jquery.ajax when I start testing on the phone, photos are not displayed. It is drawn that the photo is not available if you watch the application in the browser as html, then the photos are displayed without problems.
Photo output code.

$.ajax({
  type: 'POST',
  url: "http://host/app.php",
   	//dataType: "json",
   	encoding:"UTF-8",
  data: { get_user : 1 },
  crossDomain: true,
   	cache: false,
  success: function( response ) {
    //var obj = $.parseJSON(response);
    $('#movie-list').empty();
$('#movie-list').trigger('create');
$('#movie-list').listview('refresh');
$('#movie-list ul').listview('refresh');

    $.each(JSON.parse(response), function(idx, obj) {
      //alert(obj.name);
      console.log(obj);
      $('#imgsec').attr('src','http://host/img/'+obj.uid+'.jpg');
      $('#movie-list').append('<li><a href="#"><img id="imgsec"  />'+
      '<h2>'+obj.name+'</h2>'+
      '<p>'+obj.town+'</p>'+
      </li>');
      }
    );
    $('#movie-list').listview('refresh'); 
  }		
  });

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
troffee, 2015-02-04
@troffee

make corrections in the xml file, namely the activity on which the image is displayed

D
DevMan, 2017-09-09
@aslanovich

Aachen Bold

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question