Hi there,
I have been facing JQuery issue from few months..
Issue description:
In master page, i am making a function call which is present in some xyz.js file of same site, as shown below
<script type="text/javascript" src="/Style Library/intranetv1/js/xyz.js"></script>
<script type="text/javascript">populateStockPrice();</script>
Now in xyz.js file function written as shown below:
function populateStockPrice() {
callWebService('http://<some url>.asmx/GetQuotes', '{}', function(data) {
if (data.length == 0)
$('#stockQuoteError').show();
for (var i = 0; i < data.length; i++) {
// format the response
if(data[i].DisplaySymbol != 'PFE') continue;
var changeClass = data[i].Change == 0
? 'stockStatus'
: data[i].Change > 0
? 'stockIncrease'
: 'stockDecrease';
$('#stockQuotes').append('<a id="stockName" style="color: #000000 !important;font-weight: bold;text-decoration: none !important;" target="_blank" href="http://finance.yahoo.com/q?s=' + data[i].Symbol +'">Action Pfizer</a>');
$('#stockName').append('<span class="stockStatus">: ' + data[i].DisplayPrice + ' </span> ( ');
$('#stockName').append('<span class="' + changeClass + '">' + data[i].DisplayChange +' </span>)');
}
}, function(res) {
$('#stockQuoteError').show();
});
}
// calls an ASP.NET Web Service using jQuery
function callWebService(url, dataString, callback, errorCallback) {
if (dataString == null || dataString == '')
dataString = '{}';
$.ajax({
url: url,
data: dataString,
type: 'POST',
contentType: 'application/json; charset=utf-8',
dataType: 'json',
dataFilter: function(data) {
// This boils the response string down
// into a proper JavaScript Object().
var msg = eval('(' + data + ')');
// If the response has a ".d" top-level property,
// return what's below that instead.
if (msg.hasOwnProperty('d'))
return msg.d;
else
return msg;
},
success: callback,
error: errorCallback
});
}
We are displaying the stock values on div's which are used in the above function that is (StockQuotes, StockName div's)
However, this function is returning values correctly in IE8 (refer to the image shown below) but not working in Google Chrome(refer to the screenshot below)
IE8 result:
Google Chrome result:
could anyone help me in resolving this issue.
Thanking you in anticipation
Vikram :)