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

  • Home
  • SEARCH
  • 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 7626075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:16:35+00:00 2026-05-31T05:16:35+00:00

i have a problem regarding the responseXML of ajax.. I have this code from

  • 0

i have a problem regarding the responseXML of ajax..
I have this code from my callback function:

var lineString = responseXML.getElementsByTagName('linestring')[0].firstChild.nodeValue;

However, the linestring can only hold up to 4096 characters max.. the remaining characters are rejected.

I dont know what to use to get all the values that the lineString
returns. its quite a big data thats why I thought of using the responseXml
of AJAX, BUT turned out it still cannot accomodate everything.

My linestring consists of lines from a logfile which I concatenated and just
put line separator. I need to get this data in my form so that is why after reading from the php, i send it back via AJAX

Do you have suggestions guys.

  • 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-05-31T05:16:36+00:00Added an answer on May 31, 2026 at 5:16 am

    XML adds a lot of extra markup for most ajax requests. If you are expecting some kind of list with data entities, sending them in a JSON format is the way to go.

    I used JSON to get quite huge arrays with data.

    First of all, JSON is just Javascript Object Notation meaning that the Ajax Request would request a String which will actually be evaluated as a Javascript object.

    Some browsers offer support for JSON parsing out of the box. Other need a little help. I’ve used this little library to parse the responseText in all webapps that I developed and had no problems with it.

    Now that you know what JSON is and how to use it, here’s how the PHP code would look like.

    $response = [
       "success" => true, // I like to send a boolean value to indicate if the request 
                          // was valid and ok or if there was any problem. 
       "records" => [
         $dataEntity1, $dataEntit2 //....
       ]
    ]; 
    
    echo json_enconde($response );
    

    Try it and see what it echos. I used the php 5.4 array declaration syntax because it’s cool! 🙂

    When requesting the data via Ajax you would do:

    var response
        ,xhr = getAjaxObject(); // XMLHttp or ActiveX or whatever.
    xhr.open("POST","your url goes here");
    xhr.onreadystatechange=function() {
       if (xhr.readyState==4 && xhr.status==200) {
         try { 
           response = JSON.parse(xhr.responseText);
         } catch (err) {
           response = {
              success : false,
              //other error data
           };
         }
    
         if(response.success) {
            //your data should be in response
            // response.records should have the dataEntities
            console.debug(response.records); 
         }
       } 
    }
    

    Recap:

    1. JSON parsing needs a little help via JSON2 library
    2. PHP can send maps as JSON
    3. Success boolean is widely used as a “successful/unsuccessful” flag

    Also, if you’re into jQuery, you can just set the dataType : “json” property in the $.ajax call to receive the JSON response in the success callback.

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

Sidebar

Related Questions

I have this logical problem regarding on how to pass value from one JFrame
I have a problem regarding this two values from my textboxes (text, text2), seems
I have a problem regarding the datediff MYSQL function, I can use it and
I have a problem regarding to a JavaScript function. I used to have a
I have a problem regarding multiple inclusion of header file in C++ code. Say
I have a problem regarding display PHP code (stored in a database) on a
I have a problem regarding a JSON string grabbed from WordPress custom post meta.
I seem to have stumbled over a problem regarding saving an xml file from
I have another problem regarding Git. This time I thoroughly searched Google and Stack
I have just solved another problem regarding the same piece of code but I

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.