AJAX加载后退无数据

4/22/2015 1:56:09 PM

        jQuery(document).ready(function ($) {
            if (window.history && window.history.pushState) {
                $(window).on('popstate', function () {
                    var hashLocation = location.hash;
                    var historyurl='<%=historyUrl %>';
                    var hashSplit = hashLocation.split("#!/");
                    var hashName = hashSplit[1];
                    if (hashName !== '') {
                        var hash = window.location.hash;
                        if (hash === '' && historyurl!='') {
                            window.location.href = historyurl;
                        }
                    }
                });
                //window.history.pushState('forward', null, '<%=historyUrl %>');
            }
        });
 
1、$(function(){loaddata()});错误
2、在标签后加上<script>loaddata()</script>正确
 
问题分析,由于加载顺利,浏览器预加载与加载后执行的顺利不同