×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Nov 2008
    Posts
    54

    [moved] Please Help me Widget, XMLhttpRequest Problem

    function httpCallBack()
    {

    if(xmlHttp.readyState != 4)
    {

    }
    if (xmlHttp.readyState == 4) {

    try
    {
    var resultXml = xmlHttp.responseText;

    if(!resultXml){document.getElementById("do").innerHTML="error";}

    ------------------------
    The code I just follow the http://wiki.forum.nokia.com/index.ph...equest_Example

    Everytime when my code move to if(!resultXml) ,it trigger the error information. Who can tell me why??

    I just try to link a local xxx.xml file, It works so fine on emulator, but not works on real machine .It is so interesting. why!!!!?? really hurry

    Can anyone help me???

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

    Re: [moved] Please Help me Widget, XMLhttpRequest Problem

    Hi, if you are looking for HTTP request examples that do work, then see: http://wiki.forum.nokia.com/index.ph...th_WRT_widgets

  3. #3
    Nokia Developer Expert
    Join Date
    Jun 2008
    Location
    Tampere
    Posts
    833

    Re: [moved] Please Help me Widget, XMLhttpRequest Problem

    Hello,

    In addition to checking readyState you should also check the status. It should be 200 if call is successful. In FireFox aptana preview you will receive status 0 for some reason and if you want to get response from your PHP server, you may have to set response header manually.
    Code:
    if(ajaxrequest.readyState == 4)
    if (ajaxrequest.status == 200) {			
       writelog("ajax response got");		
    }else{
       //NB! without allownetwork access in plist a status 0 is returned with text OK!!
       writelog("ajax retrieval error: " + ajaxrequest.status+ " "+ ajaxrequest.statusText);
    }
    }
    Hope these help!

    -Ilkka

Similar Threads

  1. [moved] n95 8gb gps problem
    By mustafagologlu in forum General Development Questions
    Replies: 5
    Last Post: 2009-03-22, 00:17
  2. [moved] Problem in password setting
    By shahidur.rahman in forum Symbian User Interface
    Replies: 3
    Last Post: 2009-03-19, 11:58
  3. [moved] n79 keys problem
    By lexaru in forum General Development Questions
    Replies: 2
    Last Post: 2009-03-18, 15:49
  4. [moved] Problem with Access to SIM Card Application
    By ivoaurelio in forum Mobile Java General
    Replies: 1
    Last Post: 2008-09-19, 19:05

Posting Permissions

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