×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jul 2010
    Posts
    17

    Problem with Ajax call

    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.

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,165

    Re: Problem with Ajax call

    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

  3. #3
    Registered User
    Join Date
    Jul 2010
    Posts
    17

    Re: Problem with Ajax call

    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

  4. #4
    Registered User
    Join Date
    Oct 2010
    Location
    Trivandrum ,Kerala
    Posts
    139

    Re: Problem with Ajax call

    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

Similar Threads

  1. Replies: 9
    Last Post: 2010-11-11, 10:29
  2. Error Call ajax, wrt in localhost
    By cabeto41 in forum Symbian
    Replies: 2
    Last Post: 2010-10-10, 12:55
  3. facing problem in NMIT while integrating xhtml and ajax
    By paragpawar83 in forum Mobile Web Server
    Replies: 0
    Last Post: 2009-02-13, 12:58
  4. PyS60 and Ajax like application problem
    By alex@gorex.com.hk in forum Symbian
    Replies: 4
    Last Post: 2008-10-28, 15:25
  5. Q:streaming with AJAX
    By winwon14 in forum Mobile Web Server
    Replies: 0
    Last Post: 2007-07-17, 21:35

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×