php - How can I refresh a specific image after an update? -


I have many Divelt tag with a unique ID and a click event for a specific image I have to refresh it I am trying. how can I do this?

? & Gt; & Gt; & Lt; Table class = "table table-bursary table-condensed" & gt; & Lt; Thead & gt; & Lt; Tr style = "background color: # f5f5f5;" & Gt; & Lt; Th colspan = "2" style = "text-align: right;" & Gt; Span style = "cursor: pointer" id = "delimg_"; php echo ($ id) ;? gt; " Class = "delimg" & gt; & Lt; Span class = "label label-important" & gt; Remove & lt; / Span & gt; & Lt; / Span & gt; & Lt; / Th & gt; & Lt; / TR & gt; & Lt; / Thead & gt; & Lt; Tbody & gt; & Lt; TR & gt; & Lt; TD & gt; & Lt; Img src = "& lt ;? php echo ($ url ['url'])? & Gt;" Style = "height: 120px;" /> & Lt; / TD & gt; & Lt; TD & gt; & Lt; A href = "#" id = "rotateimg_"? Php echo ($ id) ;? gt; " Class = "rotateimg" & gt; Rotate & lt; / A & gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; / Tbody & gt; & Lt; / Table & gt; & Lt; / Div & gt;

My click event for rotation looks like this:

  $ ('. Rotateimg'). Click (function (e) {e.preventDefault () (ID), function (event); var id = $ (this) .attr ( 'id'). Substr (10); $ .post ( "/ functions / photo_functions.php ", {f: 'rotate', imgid: id} {If (status == 'true') {// I can load how specific image after being rotated again}});});    

Simply add a query string to img URL (e.g. ? V = 1 ), which will make the browser fooled into thinking that this is a new image.

Here is an example (value is the ID of the image on the page id ):

  $ ('#' + id) .prop ( 'Src', function (i, v) {var separator = v.indexOf ('?') == -1 '' ':' & amp; '; return V + divisor +' v = '+ (new date ( )) .gettime ();});   

It looks like there is no ID in your img on the page, you can cross the DOM to find it, like: < / P> $ (this). Parent (). Prev () ('& Gt; img') Find

Comments