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+")",
链接地址: http://www.djcxy.com/p/51888.html
上一篇: 用户代理字符串中的MAMD是什么?