简体   繁体   中英

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

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

And the Jquery Code:

    <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.

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+")",

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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