Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language

Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Ajax Programming

ResponseText returning Blank for Large Returns

Hey guys, I have a web app that has a javascript front end, a php back
end. The javascript calls the php function which queries a database,
and sends the information from the database, in string form, back to
the javascript, which parses the string and displays the info. This
works great until the data returned from the php script reaches a
strlength of about 500,000 or so. Then it doesnt return anything, or it
returns this message.


D4 Date: Wed, 06 Dec 2006 21:25:45 GMT Server: Apache/2.0.52 (Unix)
mod_ssl/2.0.52 OpenSSL/0.9.7d DAV/2 PHP/5.0.4-dev X-Powered-By:
PHP/5.0.4-dev Keep-Alive: timeout=15, max=97 Connection: Keep-Alive
Content-Ty 0

here's the relevant bits of code:

the javascript function


                        var loading = document.createElement('DIV');
                        loading.id = "loadingdiv";
                        loading.innerHTML = "Loading Search Results...";
                        var results = document.getElementById("results_div");


heres the ajax function

function postDataReturnText(url, data, callback)
                var XMLHttpRequestObject = false;

                if (window.XMLHttpRequest)
                XMLHttpRequestObject = new XMLHttpRequest();
                else if (window.ActiveXObject)
                XMLHttpRequestObject = new

                XMLHttpRequestObject.open("POST", url);

                        XMLHttpRequestObject.setRequestHeader('Content-Type','application/x-www-for m-urlencoded');

                XMLHttpRequestObject.onreadystatechange = function()

                        if (XMLHttpRequestObject.readyState == 4 &&
XMLHttpRequestObject.status == 200)
                        delete XMLHttpRequestObject;
                        XMLHttpRequestObject = null;



heres the relevant bit of php code

while($row = mysql_fetch_array($result, MYSQL_BOTH))// add all the
individual row info to the return string

mail subject line

                $color = getCrispColor($row);

                $feedback .= $color.$delimiter2;

                        foreach($columnlist as $value)
                                if($value != "CaseHistory")

                                else $feedback.=$row['CaseID'].$delimiter2;

                                if($columns_to_display[$i] != "CaseHistory")
                                else $feedback.=$row['CaseID'].$delimiter2;

        $n = strlen($feedback);
        $feedback = substr($feedback,0,$n-3);

        echo $feedback;

and heres the javascript function that handles the php results


function doDisplayResults(results)



like i said when the strlength in the php is over 500,000 or so,
nothing gets passed to doDisplayResults . And it returns pretty fast
with nothing as the result. This leads me to believe that the there is
a limit set somewhere in my setup that puts a block on a string return
that large. However, I've looked and looked at my
httpd.conf/php.ini/appcode till my eyes are bleeding. Something else
outside my knowledge is going on here. Any suggestions for alternate
lines of investigation i could try?



Can you call this file directly and does it load? Sounds like your server
has a limit on the size of a file it can serve up to me.


On 12/12/06, Quakerstate79 <akoele@gmail.com> wrote:

thats what i was thinking too.  I do have access to configure the
server (within reason).  I'm running apache 2.0.  I dont have much
experience configuring apache.  Does anyone know what to look for to
see if i can get the server to serve up bigger files?



I'd search for MAX* in the config files. MAX_EXECUTION_TIME and
MAX_UPLOAD_LIMIT (I know that's upload, but maybe there's something
related) are two I can think of, maybe there are more. I'm not used to
Apache 2 so I dunno if it's the same. But yeah, search for max and
limit and stuff like that in the config files of apache and php, but
maybe you've already consulted this line of reasoning...


On Dec 13, 4:20 pm, "Quakerstate79" <akoele@gmail.com> wrote:

ok, i've checked throughout httpd.conf (the apache config file) and no
dice.  I can't seem to find anything related to max dowload.   Does
anyone out there with experise in such matters have any light to shine
on our discussion?



As Eric said, can you call the file directly with it passing all 500kb+
to your browser?

i.e. if you type [your domain]/phpscripts/searchDB.php?data=[data]
(maybe you need to turn this into a POST request, but you get the
idea?) will it return whatever you usually return via ajax but to your
browser's window? If so then it's obviously either a problem with the
data or your handling, if not then it's definitely the server issue.

If you have firefox I'd suggest getting firebug
(http://www.getfirebug.com/) and seeing how long it takes to load the
ajax request and what exactly is sent (if you can't do it yourself
using a url as mentioned above). It;ll show you headers and text both
ways and how long it took to receive the data. This will most probably
help you debug if it's not a server issue. When you've finally made
certain that it's definitely a server issue, then you can work out why
your server's being so selective about how much it sends because, as
you say, your server looks like it's set up fine.


On Dec 14, 11:00 pm, "Quakerstate79" <akoele@gmail.com> wrote:

well its not passing 500,000KB, its passing 500,000 characters.  I'll
try the calling it directly  , and post back



So it has the exact same behavior calling it directly, which by your
reasoning means its definitely a server issue right?   Man, what should
i do?



On Dec 15, 6:48 pm, "Quakerstate79" <akoele@gmail.com> wrote:

> So it has the exact same behavior calling it directly, which by your
> reasoning means its definitely a server issue right?   Man, what should
> i do?

Looks like a server setup issue to me, so all I can really think of now
is maybe to try contacting the 'owner' of the server. (You said you
have pretty good but not perfect access to the server so that suggests
there is an owner somewhere that may be able to help.)


Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc