Discussion:
problem refreshing an image in a dialog box
jdgamble555
2010-02-12 04:28:38 UTC
Permalink
I am having problems refreshing an image in a dialog box. If I move
the div outside of the dialog box, it works fine with this:

var img = db_cgi_url + "/photo.cgi?do=view;ID=" + ID + ";" +
now.getTime();
$("#myImage").attr("src", img);

Unfortunately, this does not work when the div is inside the dialog
box, no matter if I move the code after the "open" command or in the
"open" callback function.

Any suggestions?


function edit_thumb() {
$("#imageDialog").dialog('destroy');
$("#imageDialog").dialog({
autoOpen: false,
closeOnEscape: true,
resizable: true,
height: 'auto',
width: 'auto',
buttons: {
'Edit Thumb': function() {
$("#imageDialog").submit();
},
Cancel: function() {
$(this).dialog('close');
}
},
close: function() {
},
open: function() {
var img = db_cgi_url + "/photo.cgi?do=view;ID=" + ID + ";" +
now.getTime();
$("#myImage").attr("src", img);
}
});
$("#imageDialog").dialog('open');
return false;
}
jdgamble555
2010-02-12 04:41:24 UTC
Permalink
Actually I just found that I have the same problem with text inside a
<div>

if I put this in the open function with this div located in my dialog,

$("#changethisdiv").html("it is changed at" + new Date().getTime());

It will work one time, then it will no longer change after each time
it is opened...?
I am having problems refreshing an image in a dialog box.  If I move
      var img = db_cgi_url + "/photo.cgi?do=view;ID=" + ID + ";" +
now.getTime();
      $("#myImage").attr("src", img);
Unfortunately, this does not work when the div is inside the dialog
box, no matter if I move the code after the "open" command or in the
"open" callback function.
Any suggestions?
function edit_thumb() {
  $("#imageDialog").dialog('destroy');
  $("#imageDialog").dialog({
    autoOpen: false,
    closeOnEscape: true,
    resizable: true,
    height: 'auto',
    width: 'auto',
    buttons: {
      'Edit Thumb': function() {
        $("#imageDialog").submit();
      },
      Cancel: function() {
       $(this).dialog('close');
      }
    },
    close: function() {
    },
    open: function() {
      var img = db_cgi_url + "/photo.cgi?do=view;ID=" + ID + ";" +
now.getTime();
      $("#myImage").attr("src", img);
    }
  });
  $("#imageDialog").dialog('open');
  return false;
}- Hide quoted text -
- Show quoted text -
Loading...