javascript - IE img load returns error -
i trying insert image ajax repsonse. work, not in ie.
i have tried: image load not working ie 8 or lower, "broken image".
tried solve described here: http://www.paulund.co.uk/handle-image-loading-errors-with-jquery, not solve anything. did not attach document.ready function though, since ajax, ie < 9 hack never triggered ajax call. ajax phone call triggered mouse click repsonds image link. when using jquery's dialog function, ie not show image. forcing right-clicking , 'show image' shows image.
anybody know how solve problem?
function search(url){ $.ajax({ type: "get", url: url, datatype: "html", success: function(data, status, xmlhttpresponse){ clicklistenerevent(); }, error: function(data, textstatus, xmlhttpresponse){ alert("ajax error"); } }); } function clicklistenerevent(){ $('a.show-image').click(function (e) { var element = $(this); var href = element.attr('href'); var title = element.attr('title'); var thisid = 'dialogbox_'; var exisitingdialog = $('.dialogbox[id='+thisid+']'); if(!exisitingdialog.length){ element.parent().append("<div id='"+thisid+"'></div>"); } var thisdialog = $('.dialogbox[id='+thisid+']'); var img = new image(); $(img).load(function() { alert('successfully loaded'); }).error(function() { alert('broken image!'); //$(this).attr('src', href); }).attr('src', href); $(thisdialog).append(img); //create dialog $('.dialogboks[id='+thisid+']').dialog({ closetext: 'close', title: title }); if ( $.browser.msie && $.browser.version < 9 ) { $('img').each(function(){ $(this).attr('src', $(this).attr('src')); }); } e.preventdefault(); }); }
javascript jquery internet-explorer
No comments:
Post a Comment