0

I wrote an ajax call to change an image and show it back on the browser when the ajax call succeeds. But the image does not change on IE and Firefox. It works fine on Chrome.

var url =  "/store/artwork/index/renderSVGFile?"+"docID=<?php echo $docID ?>&unique="+(new Date()).getTime();
    jQuery('*').css('cursor', 'wait');
        jQuery.ajax({
            url: url,
            cache:false,
            type: "POST",
            data: {},
            success: function(data) {
                jQuery('#product-img-template').html("<img src='/path/to/image/<?php echo $docID ?+>.png' />");
                jQuery('#product-img-template').css("position", "relative");
                jQuery('#product-img-template').css("top","-430px");
                jQuery('#product-img-template').css("left","-7px");
                jQuery('#product-img-template').css("height","400px");
                jQuery('#product-img-template').css("margin-bottom","-350px");
                jQuery('#product-img-template').css("z-index","20");
                jQuery('*').css('cursor', 'auto'); 
            },
            failure: function(data) {
                 jQuery('*').css('cursor', 'auto'); 
            }
        });

I can see the image has already been changed, but not shown on the browser. Could anyone help me with this?

1 Answer 1

1

The cache false doesn't relate to the image your showing. So for the line

jQuery('#product-img-template').html("<img src='/path/to/image/<?php echo $docID ?+>.png' />");

Change it to this for example - like you do in your ajax url

jQuery('#product-img-template').html("<img src='/path/to/image/<?php echo $docID ?+>.png?" + (new Date()).getTime() + "' />");
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.