简体   繁体   English

Internet Explorer中的Javascript jQuery错误触发

[英]Javascript jQuery error firing in Internet Explorer

Here is the code and the error message: 这是代码和错误消息:

Webpage error details 网页错误详细信息

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.2) Timestamp: Wed, 18 Jan 2012 20:26:33 UTC 用户代理:Mozilla / 4.0(兼容; MSIE 8.0; Windows NT 6.1; WOW64; Trident / 4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.2)时间戳:星期三,2012年1月18日20:26:33 UTC

Message: Unexpected call to method or property access. 消息:对方法或属性访问的意外调用。 Line: 3 Char: 31959 Code: 0 URI: https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js 行:3字符:31959代码:0 URI: https ://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js

And the Jquery Code: 和jQuery代码:

    <script type="text/javascript">
        $(document).ready(function() {
            $('.small-list-items-pagination li a').click(function(e) {
                e.preventDefault();
                $.ajax({
                    type: "GET",
                    url: '/Noticias/FetchMiniNoticiasFromPage',
                    data: "page=" + $(this).text(),
                    dataType: "json",
                    success: function (data) {
                        $('.small-list-items li').remove();

                        $.each(data, function(i, val){
                            $(".small-list-items").append('<li>' +
                                '<img src="' + val.ImagenChicaUrl + '" alt="' + val.Descripcion + '"/>' +
                                '<a href="#">' + val.FechaDePublicacion + '</a>' +
                                '<p>' + val.Descripcion + '</p>' +
                                 '<div class="horizontal-line"></div>' +
                            '</li>');
                        });
                    },
                    error: function (obj) {
                        alert("bad!");
                    }
                });
            });
        });
    </script>

Any ideas what's wrong? 任何想法有什么问题吗? This works great in Firefox, Opera, Google Chrome. 这在Firefox,Opera,Google Chrome中非常有效。

This line: 这行:

'@Url.Action("FetchMiniNoticiasFromPage", "Noticias")'

Actually compiles to: 实际编译为:

'/Noticias/FetchMiniNoticiasFromPage'

it could be the nested double quotes, although i cant beleive other browsers let you get away with that: 它可能是嵌套的双引号,尽管我不能相信其他浏览器会让您逃脱这一点:

url: "@Url.Action('FetchMiniNoticiasFromPage', 'Noticias')",

--OR-- - 要么 -

url: '@Url.Action("FetchMiniNoticiasFromPage", "Noticias")',

or are you trying: 还是在尝试:

url: "@Url.Action("+FetchMiniNoticiasFromPage+", "+Noticias+")",

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM