Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8897977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:29:28+00:00 2026-06-15T00:29:28+00:00

I have having trouble with retrieving chatmessages in winjs.xhr: function getMessage() { var time

  • 0

I have having trouble with retrieving chatmessages in winjs.xhr:

  function getMessage() {
        var time = MESSAGE_RETURNED.unixtime;
        if (time == 0) {
            time= window.parent.SESSION.unixtime;
        }

        WinJS.xhr({
            url: "http://www.example.com/scripts/default.php?"
               + "action="+ACTIONS.GET_MESSAGE
               + "&username=" + window.parent.SESSION.username
               + "&session_id=" + window.parent.SESSION.session_id
               + "&unixtime=" + time
        }).done(
           function fulfilled(result) {
               console.log("action=" + ACTIONS.GET_MESSAGE
               + "&username=" + window.parent.SESSION.username
               + "&session_id=" + window.parent.SESSION.session_id
               + "&unixtime=" + time);//CHECK INPUTS , ALL GREEN

               if (result.status === 200) {

                   if (result.response.toString.length === 0) {
                       return false;
                   }//ALWAYS TRUE;
                   else {
                       console.log(JSON.parse(result.response));

                  }
               } else {
                   document.getElementById("messagelogarea").value += result.status + "\r\n";
               }
           });
    }

I am trying to retrive JSON from php. However, the response I give back is always null when using WinJS.xhr. If put the direct link in my browser, i will have results like this:
(an array which contains 3 chat messages)

{
    "message": [
        {
            "_id": "428",
            "from_TBonlineusers_id": "00477",
            "fromTBonlineusers_username": "GUEST_477",
            "fromTBonlineusers_type": "GUEST",
            "messagetype": "PUBLIC",
            "message": "wat?xxwiii",
            "chatmessagetime": "2012-11-16 15:36:06",
            "unixtime": "1353098166"
        },
        {
            "_id": "429",
            "from_TBonlineusers_id": "00477",
            "fromTBonlineusers_username": "GUEST_477",
            "fromTBonlineusers_type": "GUEST",
            "messagetype": "PUBLIC",
            "message": "wat?xxwiii",
            "chatmessagetime": "2012-11-16 15:42:42",
            "unixtime": "1353098562"
        },
        {
            "_id": "430",
            "from_TBonlineusers_id": "00477",
            "fromTBonlineusers_username": "GUEST_477",
            "fromTBonlineusers_type": "GUEST",
            "messagetype": "PUBLIC",
            "message": "wat?xxwiiir",
            "chatmessagetime": "2012-11-16 15:42:48",
            "unixtime": "1353098568"
        }
    ]
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T00:29:30+00:00Added an answer on June 15, 2026 at 12:29 am

    toString is a method of most objects.

    Your line result.response.toString.length should be result.response.toString().length

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a feeling I'm asking a stupid question here. I'm having trouble retrieving
I'm starting in JS and have been having trouble with a particular function I'm
I have been having some trouble with the facebook SDK, specifically retrieving an access
I have been having trouble pulling up a custom UIPickerView from the textfield's inputview
I have been having trouble with opening files with ifstream if I do: ifstream
Hello I have been having trouble with this for a while now. I have
I have been having some real trouble with this for a while. I am
Im having trouble with creating a JS bookmarklet, I have the following that when
I'm having trouble with PHP text parsing I have a txt file which has
I'm having trouble grasping generic methods. I have two classes that are generated (they

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.