IE "Microsoft JScript runtime error: Object expected"
- by Stephen Borg
Hi there,
I have problems with regards to javascript only when using IE. The error I am getting is "Microsoft JScript runtime error: Object expected" and I have no idea why. It is then jumping into the JQuery 1.4.2 file, without giving me a proper error message.
All I am doing is simply reading on page load the raw URL, and getting a query string named Search. Using that in an AJAX call to return products and put then into a DIV. No biggies, but somehow IE is managing to blow my page up :-(
Any ideas? Code as follows :
<script type="text/javascript">
$(document).ready(function (e) {
$('.boxLoader').show();
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(window.location.href);
if (results == null)
return "";
else
return decodeURIComponent(results[1].replace(/\+/g, " "));
}
var Search;
Search = getParameterByName("search");
$('#searchCriteria').text(Search);
$.get("/Handlers/processProducts.aspx", { SearchCriteria: Search }, function (data) {
$('#innercontent').html(data);
$('#innercontent').fadeIn(200);
$('.boxLoader').fadeOut(200);
});
$('#searchBox').live("click", function () {
$.get("/Handlers/processProducts.aspx", { SearchCriteria: $('#searchCriteria').val() }, function (data) {
$('#innercontent').html(data);
$('#innercontent').fadeIn(200);
$('.boxLoader').fadeOut(200);
});
});
});
</script>