How to reload/refresh an element(image) in jQuery : Reloading/Refreshing the image element(same filename) via Jquery AJAX
$("#image1").attr("src", "{$base_url}tmp/survey/image1.png?ts=" + new Date().getTime()); $("#image2").attr("src", "{$base_url}tmp/survey/image2.png?ts=" + new Date().getTime());Please check below the example of deployed function via AJAX...
function viewReportBtn(id) { $('#survey_id').val(id); $('#dvLoading').show(); // Loader On var formData = $("#thisForm").serialize(); $.ajax({ url: '{$base_url}school/reports/view', data: formData, type: 'post', complete: function(output) { var str = output.responseText; resultStatus = str.substr(0,7); resultText = str.substr(7,(str.length)); if (resultStatus == 'success') { $('#searchResult').show().html(resultText); // show the result list on a search result container $("#lineChart").attr("src", "{$base_url}tmp/survey/linechart.png?ts=" + new Date().getTime()); $("#pieChart").attr("src", "{$base_url}tmp/survey/piechart.png?ts=" + new Date().getTime()); } else { $('#searchResult').html('').hide(); // hiding the search result container } $('#dvLoading').fadeOut(10); // To Switch Off the loader.. } }); }
No comments:
Post a Comment
Please post any queries and comments here.