-3

I need to make an Ajax call to get the image source from the server side using ASP.NET C#.

I got below code example:

$('#popup-container').click(function() {
  $.ajax({
    type: "GET",
    url: "img/popup_calculating.gif",
    dataType: "image/gif",
    success: function(img) {
      i = new Image();
      i.src = img;
      $(this).append(i);
    },
    error: function(error, txtStatus) {
    }
  });
});

The above code want to implement using ASP.NET C# .aspx pages, but I do not able to understand for implementation, to call images from the server, My requirements are to develop like below.

http://epaper.deccanchronicle.com/epaper_main.aspx#page986808

Marc
  • 3,819
  • 4
  • 22
  • 34
mohd mazhar khan
  • 103
  • 1
  • 9
  • 37

1 Answers1

1

Well for a start, $(this) is not what you think it is because it's contained within a different scope (the success callback of the $.ajax request).

$('#popup-container').click(function() {
var container = $(this);
$.ajax({
    type: "GET",
    url: "img/popup_calculating.gif",
    dataType: "image/gif",
    success: function(imgSrc) {
      $(container).append('<img src="' + imgSrc + '" />);
    },
    error: function(error, txtStatus) {

    }
});

});

John Mc
  • 2,803
  • 1
  • 21
  • 37