am using asp.net with Ajax timer update panel and script-manager in page load i get data and work around it every timer tick am using jquery to show my data in JavaScript chart control in IE work good put in Firefox 3.6.7 no data show to me and get me error in error console say:
sys.webforms.page request manager server error exception:An unknown error occured while processing the request on server. The status code returned from the server was:0
<script type ="text/C#" runat= server>
public string Usd;
protected void Page_Load(object sender, EventArgs e)
{
MyMethod1();
}
protected void Timer1_Tick(object sender, EventArgs e)
{
MyMethod1();
}
public void MyMethod1()
{
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
//get table from website ind put it in xml
doc.LoadXml(@TinyEAIPostRequest("http://xxx.com/advancid%20quotes/quotes2test.php"));
foreach (System.Xml.XmlNode ndRow in doc.DocumentElement.ChildNodes)
{
switch (ndRow.ChildNodes[1].InnerText)
{
case "EURUSD":
Usd = ndRow.ChildNodes[2].InnerText;
EURUSD1.ImageUrl = "img/" + ndRow.ChildNodes[0].InnerText + ".gif";
EURUSD2.Text = ndRow.ChildNodes[1].InnerText;
EURUSD3.Text = ndRow.ChildNodes[2].InnerText;
EURUSD4.Text = ndRow.ChildNodes[3].InnerText;
break;
}
}
}
public string TinyEAIPostRequest(string strURL )
{
string strRequest="test";
System.Net.HttpWebResponse objHttpWebResponse = null;
UTF8Encoding encoding;
string strResponse = "";
System.Net.HttpWebRequest objHttpWebRequest;
objHttpWebRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(strURL);
objHttpWebRequest.ContentType = "application/x-www-form-urlencoded";
objHttpWebRequest.PreAuthenticate = true;
objHttpWebRequest.Method = "POST";
//Prepare the request stream
if (strRequest != null && strRequest != string.Empty)
{
encoding = new UTF8Encoding();
System.IO.Stream objStream = objHttpWebRequest.GetRequestStream();
Byte[] Buffer = encoding.GetBytes(strRequest);
// Post the request
objStream.Write(Buffer, 0, Buffer.Length);
objStream.Close();
}
objHttpWebResponse = (System.Net.HttpWebResponse)objHttpWebRequest.GetResponse();
encoding = new UTF8Encoding();
System.IO.StreamReader objStreamReader = new System.IO.StreamReader(objHttpWebResponse.GetResponseStream(), encoding);
strResponse = objStreamReader.ReadToEnd();
objHttpWebResponse.Close();
objHttpWebRequest = null;
return strResponse;
}
</script>
<script type="text/javascript">
var chart;
function requestData() {
$.ajax({
url: 'http://fxsolegypt.com/advancid%20quotes/quotes2test.php',
success: function(point) {
var series = chart.series[0],
shift = series.data.length > 30; // shift if the series is longer than 20
// alert (document.getElementById('EURUSD2').firstChild.data)
// alert((new Date()).getTime() + ',' + document.getElementById('TextBox1').value)
// add the point
// chart.series[0].addPoint(eval(<%= Usd %>), true, shift);
chart.series[0].addPoint(eval('[' + (new Date()).getTime() + ',' + document.getElementById('EURUSD3').firstChild.data + ']'), true, shift);
chart.series[1].addPoint(eval('[' + (new Date()).getTime() + ',' + document.getElementById('EURUSD4').firstChild.data + ']'), true, shift);
// call it again after one second
setTimeout(requestData, 3000);
},
cache: false
});
}
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
defaultSeriesType: 'spline',//'area',
backgroundColor: {
linearGradient: [0, 0, 500, 500],
stops: [
[0, 'rgb(31, 31, 31)'],
[1, 'rgb(61, 61, 61)']
]
},
events: {
load: requestData
}
},
title: {
text: 'EUR to USD Exchange Rate'
},
legend: {
borderWidth: 1,
backgroundColor: '#FFFFFF'
},
xAxis: {
type: 'datetime',
tickPixelInterval: 150,
maxZoom: 20 * 1000
},
yAxis: {
minPadding: 0.2,
maxPadding: 0.2,
title: {
text: 'Value',
margin: 80,
}
},
credits: {
enabled: false
},
tooltip: {
formatter: function() {
return '<b>' + this.series.name + '</b><br/>' +
Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) + '<br/>' +
'1 EUR= ' + Highcharts.numberFormat(this.y, 2) + ' USD';
},
backgroundColor: {
linearGradient: [0, 0, 0, 60],
stops: [
[0, '#FFFFFF'],
[1, '#D0D0D0']
]
}
},
series: [{
name: 'الطلب',
data: []
}, {
name: 'العرض',
data: []
}]
});
});
</script>