0
votes

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'
1
What does @Url.Action("FetchMiniNoticiasFromPage", "Noticias") output?Jasper
Can you change "@Url.Action("FetchMiniNoticiasFromPage", "Noticias")" to '@Url.Action("FetchMiniNoticiasFromPage", "Noticias")'Selvakumar Arumugam
@SKS: It's still firing the same error.Only Bolivian Here
Is it going inside your success call back method? Can you set some alert to narrow down?Selvakumar Arumugam
IE croaks on any single error so I can't tell when it's firing. But the error message that prompts up says the line and the error is within the jQuery file itself. That's why I'm confused.Only Bolivian Here

1 Answers

0
votes

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