Our application makes http request calls through ajax method in S60 3rd edition FP1 (E71 & E63) using wrt1.0.,but it’s not working properly.
Please let me know if any alternative method needs to be followed
Our application makes http request calls through ajax method in S60 3rd edition FP1 (E71 & E63) using wrt1.0.,but it’s not working properly.
Please let me know if any alternative method needs to be followed
Last edited by suryasraj; 2011-06-07 at 06:28.
How have you done it, and what is happening ?
Wiki would have working examples, here's some of them: http://wiki.forum.nokia.com/index.ph...th_WRT_widgets
Thank you, I have made some progress with this.
But now, a new problem cropped in. All Ajax calls from html body onload event works fine. If I trigger a new Ajax call from an user event, it will fail. The status returned is 'undefined' which is not there in w3 documentation. Here is my code
function newAjaxRequest(url,params,callBackFn,callBackParams){
try {
var xmlHttp= Ajax();
xmlHttp.open("get",url,true);
xmlHttp.setRequestHeader("Connection","Close");
xmlHttp.onreadystatechange =function(){
if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 200) {
callBackFn(xmlHttp.responseXML, callBackParams);
}
else
alert("Error from server : "+xmlHttp.statusText);
}
}
xmlHttp.send(params);
} catch (e) {
alert("Unable to connect to server, please try again later" );
}
}
I searched in internet for similar issues(status=undefined) and found a few hits. All refer to a bug in safari where Ajax calls are cached. But using no-cache or adding a timestamp to the url does not help.
Please advise.
Regards,
Surya
Hi,
Declare the variables globally and try this code,
function newAjaxRequest(url,params)
{
if(xmlHttp==null)
{
xmlHttp = new XMLHttpRequest();
}
xmlHttp.open("get", url, true);
xmlHttp.send(params);
xmlHttp.onreadystatechange = Reqstatefn;
}
function Reqstatefn()
{
if (xmlHttp.readyState == 4)
{
if (xmlHttp.status == 200)
{
alert(xmlHttp.responseText);
}
else
{
alert("Error");
}
}
}
sreerajvr