Reputation: 1003
I am trying to run a jquery/ajax call that works in IE9, Chrome, FF, Opera However, it fails in IE8 and UE7
The code:
$.ajax({url:plink,
success: function(result) {
ppriser = result.split("**")[1];
plabels = result.split("**")[2];
pgrupper = result.split("**")[3];
priser = ppriser.split("!#");
labels = plabels.split("!#");
grupper = pgrupper.split("!#");
$("td .pricetag").each( function() {
var slutpris = "999999";
var slutlabel = "";
for(i=1;i<priser.length;i++) {
str = String($(this).attr('group'));
grp = String(grupper[i]);
pos = grp.indexOf(str);
if(grp==str || pos>=0) {
j=parseInt(priser[i]);
k=parseInt(slutpris);
if(j!=0 && j<k) {
slutpris = priser[i];
slutlabel = labels[i];
}
if(slutlabel=="") { slutlabel = "fra:"; }
if(slutpris!="999999") {
$(this).html(slutpris);
$(this).prev('td').html(slutlabel);
}
if(slutpris=="999999") {
$(this).css('display','none');
$(this).closest('.pris').css('display','none');
}
}
}
});
}});
I have tried various combos of: cache:false, type:"POST", type:"GET", data:"HTML", dataType:"HTML", timeout: 10000,
An example of the link plink:
Default.aspx?ID=148&fb=true&mode=-1&groupid=1210405@@SHOP5,1210103@@SHOP5,
The jquery link:
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
The ajax script link is placed at the end of the page.
Upvotes: 0
Views: 2504
Reputation: 1003
I tried to cast to string in several wasy (as IE 8/7 does not like indexOf on array objects) but to no avail. Thereafter, I found this solution.
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function(obj, start) {
for (var i = (start || 0), j = this.length; i < j; i++) {
if (this[i] === obj) { return i; }
}
return -1;
}
}
I test if indexOf is supported - and if not the function is created.
Upvotes: 1