开发者

Why doesn't Javascript (Internet Explorer) show my html table using this function?

开发者 https://www.devze.com 2023-04-11 10:21 出处:网络
I´m using internet explorer 8 and asp.net mvc 3 to develop my web applicat开发者_如何学运维ion. I have this code:

I´m using internet explorer 8 and asp.net mvc 3 to develop my web applicat开发者_如何学运维ion. I have this code:

<div id="table_chart_placeholder">
    @{ Html.RenderAction("Table", "Charts"); }
    </div>
</body>

<script type="text/javascript">
        function chartIndicator() {
        var chartImage = document.getElementById('chart_image');
        chartImage.src = chartImage.src + "?" + new Date().getTime();
        jQuery("#table_chart_placeholder").append("<div></div>").load('@Url.Action("Table", "Charts")');
</script>

I can't see the table. Any idea why this happens? If something is not clear please ask me what you need.


you are trying to do something when the document is ready? you got the document ready function wrong. try this:

<div id="table_chart_placeholder">
    @{ Html.RenderAction("Table", "Charts"); }
    </div>
</body>

<script type="text/javascript">
        $(function () {
               jQuery("#table_placeholder").append("<div></div>").load('@Url.Action("Table", "Charts")');
              });
</script>


Ok, the problem was caching and I solve it using ajaxSetup in the function like this:

$.ajaxSetup({ cache: false });
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号