By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,348 Members | 1,397 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,348 IT Pros & Developers. It's quick & easy.

ajax.response max size

P: n/a
I am using ajax / php where I am looking up some info from the
database and populating a select list dynamically, however I am
running into some sort of size limitation with the ajax.response
object. If the string I am passing to javascript from php is too large
javascript does not get it all the data. The magic number appears to
be 6123 characters, anything below that it works fine, anything above
and if I alert the ajax.response, I see the string is cutoff. Any
ideas where this limitation is defined?

Feb 24 '07 #1
Share this Question
Share on Google+
10 Replies


P: n/a
tr****@gmail.com said the following on 2/23/2007 7:48 PM:
I am using ajax / php where I am looking up some info from the
database and populating a select list dynamically, however I am
running into some sort of size limitation with the ajax.response
object. If the string I am passing to javascript from php is too large
javascript does not get it all the data. The magic number appears to
be 6123 characters, anything below that it works fine, anything above
and if I alert the ajax.response, I see the string is cutoff. Any
ideas where this limitation is defined?
Probably implementation independent. But, if you are trying to pass 6K+
of data you are doing something wrong. That is a *lot* of data.
Especially for a select list.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 24 '07 #2

P: n/a
بسم الله الرحمن الرحيم
افضل موقع للتعارف بين الجنس ين الشباب والبنات من كل دول العالم
www.arabzwaj.com

بنات وشباب عايزيين يتعرفوا عليكم
صور عارية حقيقية
تعارف مجاني من كل دول العالم www.arabzwaj.com
for marrige and friend shipافضل تعارف بين الشباب والبنات موقع زواج
مجاني www.arabzwaj.com

www.arabzwaj.com افضل موقع مجاني للتعارف و للزواج الشرعي

www.arabzwaj.com بنات وشباب عايزه تتعرف عليكم

the best web site formarrige and frindship www.arabzwaj.comافضل موقع
مجاني للتعارف و للزواج
Feb 24 '07 #3

P: n/a
بسم الله الرحمن الرحيم
افضل موقع للتعارف بين الجنس ين الشباب والبنات من كل دول العالم
www.arabzwaj.com

بنات وشباب عايزيين يتعرفوا عليكم
صور عارية حقيقية
تعارف مجاني من كل دول العالم www.arabzwaj.com
for marrige and friend shipافضل تعارف بين الشباب والبنات موقع زواج
مجاني www.arabzwaj.com

www.arabzwaj.com افضل موقع مجاني للتعارف و للزواج الشرعي

www.arabzwaj.com بنات وشباب عايزه تتعرف عليكم

the best web site formarrige and frindship www.arabzwaj.comافضل موقع
مجاني للتعارف و للزواج
Feb 24 '07 #4

P: n/a
On 23 Feb 2007 16:48:19 -0800, in comp.lang.javascript
tr****@gmail.com
<11**********************@p10g2000cwp.googlegroups .comwrote:
>| I am using ajax / php where I am looking up some info from the
| database and populating a select list dynamically, however I am
| running into some sort of size limitation with the ajax.response
| object. If the string I am passing to javascript from php is too large
| javascript does not get it all the data. The magic number appears to
| be 6123 characters, anything below that it works fine, anything above
| and if I alert the ajax.response, I see the string is cutoff. Any
| ideas where this limitation is defined?
Your page:
<select name="lbItems" onChange="AJAXCall(this.value);">
<option value="1">1</option>
etc etc etc
</select>

Javascript function on your page
function AJAXCall(val)
{
//--- make your ajaxcall here
url = "mypage.php?id=" + val;
}

php page:
<?php
$id = 0;
if( isset($_GET['id]) ) $id = $_GET['id'];
if( !is_numeric($id) ) $id =0;

//--- read database
$sql = "SELECT * FROM yourtable WHERE pk=".$id;

//--- loop through recordset and populate listbox
echo "<option value='".$recPK."'>".$recText."</option>\n";
?>
---------------------------------------------------------------
jn******@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
Feb 24 '07 #5

P: n/a
I frequently use Ajax requests with responses of 100K+ with no
problems for both IE and FF.
Kris

On Feb 23, 7:14 pm, Jeff North <jnort...@yahoo.com.auwrote:
On 23 Feb 2007 16:48:19 -0800, in comp.lang.javascript
trp...@gmail.com

<1172278099.323577.325...@p10g2000cwp.googlegroups .comwrote:
| I am using ajax / php where I am looking up some info from the
| database and populating a select list dynamically, however I am
| running into some sort of size limitation with the ajax.response
| object. If the string I am passing to javascript from php is too large
| javascript does not get it all the data. The magic number appears to
| be 6123 characters, anything below that it works fine, anything above
| and if I alert the ajax.response, I see the string is cutoff. Any
| ideas where this limitation is defined?

Your page:
<select name="lbItems" onChange="AJAXCall(this.value);">
<option value="1">1</option>
etc etc etc
</select>

Javascript function on your page
function AJAXCall(val)
{
//--- make your ajaxcall here
url = "mypage.php?id=" + val;

}

php page:
<?php
$id = 0;
if( isset($_GET['id]) ) $id = $_GET['id'];
if( !is_numeric($id) ) $id =0;

//--- read database
$sql = "SELECT * FROM yourtable WHERE pk=".$id;

//--- loop through recordset and populate listbox
echo "<option value='".$recPK."'>".$recText."</option>\n";
?>
---------------------------------------------------------------
jnort...@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------

Feb 24 '07 #6

P: n/a
On Feb 24, 7:53 am, "Kris Zyp" <kris...@gmail.comwrote:
I frequently use Ajax requests with responses of 100K+ with no
problems for both IE and FF.
Kris
On a related note: does anybody know how to /post/ more data at the
AJAX call? Normally, any parameters you use are in the URL. But I
would like to be able to post a lot of data to the server... any
idea's?

Paul

Feb 24 '07 #7

P: n/a
On 24 Feb 2007 01:06:22 -0800, in comp.lang.javascript
"pw******@gmail.com" <pw******@gmail.com>
<11**********************@j27g2000cwj.googlegroups .comwrote:
>| On Feb 24, 7:53 am, "Kris Zyp" <kris...@gmail.comwrote:
| I frequently use Ajax requests with responses of 100K+ with no
| problems for both IE and FF.
| Kris
|
| On a related note: does anybody know how to /post/ more data at the
| AJAX call? Normally, any parameters you use are in the URL. But I
| would like to be able to post a lot of data to the server... any
| idea's?
http://ajaxtoolbox.com/request/examples.php

then scroll to Form Submittal.
---------------------------------------------------------------
jn******@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
Feb 24 '07 #8

P: n/a
Ok, Here is the code for what I am doing, and the ajax library being
used is SACK from http://twilightuniverse.com/projects/sack/ I just
can't seem to pass more than about 6100 characters... Any ideas, or a
better way to go?

<?php

//If some search criteria was sent
if(isset($_GET['searchCriteria']))
{

//////////////////////////////// DB
Connection ///////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////

include('./adodb/adodb.inc.php');

//Type of connection
$db = NewADOConnection('oci8');

//Sets the query results to come back as assoc arrays
$db->SetFetchMode(ADODB_FETCH_ASSOC);

//Make the connection
$db->PConnect('xxxxx', 'yyyyy', 'zzzzz');

//////////////////////////////////////////////////////////////////////////////////////////////////////

$rs = $db->Execute("SELECT DISTINCT ID, NAME FROM PEOPLE WHERE
UPPER(NAME_DISPLAY) LIKE '".$_GET['searchCriteria']."%'");

$results = null;
while ($arr = $rs->FetchRow()) {
echo "obj.options[obj.options.length] = new
Option('".rawurlencode($arr["NAME"])."','".rawurlencode($arr["ID"])."');
\n";
}

exit;
}

?>

<link href="style.css" rel="stylesheet" type="text/css" />

<!-- AJAX for processing customer name search -->
<script type="text/javascript" src="ajax.js"></script>
<script type="text/javascript">

var ajax = new sack();

function searchInput(input)
{
//Set a variable to hold the value from the form input field
var searchCriteria = input.value;

//Empty results select box
document.getElementById('result').options.length = 0;

//If there is search criteria, then process
if(searchCriteria.length>0)
{
//Pass to php to process
ajax.requestFile = 'tst2.php?searchCriteria='+searchCriteria;

//Specify function that will be executed to display results
ajax.onCompletion = createResults;

//Execute AJAX function
ajax.runAJAX();
}
}

function createResults()
{
var obj = document.getElementById('result');

//Executing the response from Ajax as Javascript code
//Sent from php as an escaped string so must escape
alert(unescape(ajax.response));
eval(unescape(ajax.response));
}

</script>
<!-- END AJAX for processing customer name search -->
<table>
<tr>
<td><b>Customer Name:</b></td>
<td>
<input class="cust" id="search" name="search" type="text"
onchange="searchInput(this)">
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><select multiple size="10" id="result" name="result">

</select>
</td>
</tr>
</table>

Feb 27 '07 #9

P: n/a
On 27 Feb 2007 15:12:53 -0800, in comp.lang.javascript
tr****@gmail.com
<11*********************@k78g2000cwa.googlegroups. comwrote:
>| Ok, Here is the code for what I am doing, and the ajax library being
| used is SACK from http://twilightuniverse.com/projects/sack/ I just
| can't seem to pass more than about 6100 characters... Any ideas, or a
| better way to go?
I recommend POSTing your form that way there is virtually no limit on
the input size.
>| <?php
|
| //If some search criteria was sent
| if(isset($_GET['searchCriteria']))
| {
|
| //////////////////////////////// DB
| Connection ///////////////////////////////////////////////////////
| //////////////////////////////////////////////////////////////////////////////////////////////////////
|
| include('./adodb/adodb.inc.php');
|
| //Type of connection
| $db = NewADOConnection('oci8');
|
| //Sets the query results to come back as assoc arrays
| $db->SetFetchMode(ADODB_FETCH_ASSOC);
|
| //Make the connection
| $db->PConnect('xxxxx', 'yyyyy', 'zzzzz');
|
|
|
| //////////////////////////////////////////////////////////////////////////////////////////////////////
|
| $rs = $db->Execute("SELECT DISTINCT ID, NAME FROM PEOPLE WHERE
| UPPER(NAME_DISPLAY) LIKE '".$_GET['searchCriteria']."%'");
|
| $results = null;
| while ($arr = $rs->FetchRow()) {
| echo "obj.options[obj.options.length] = new
| Option('".rawurlencode($arr["NAME"])."','".rawurlencode($arr["ID"])."');
| \n";
| }
|
| exit;
| }
|
| ?>
|
| <link href="style.css" rel="stylesheet" type="text/css" />
|
| <!-- AJAX for processing customer name search -->
| <script type="text/javascript" src="ajax.js"></script>
| <script type="text/javascript">
|
| var ajax = new sack();
|
| function searchInput(input)
| {
| //Set a variable to hold the value from the form input field
| var searchCriteria = input.value;
|
| //Empty results select box
| document.getElementById('result').options.length = 0;
|
| //If there is search criteria, then process
| if(searchCriteria.length>0)
| {
| //Pass to php to process
| ajax.requestFile = 'tst2.php?searchCriteria='+searchCriteria;
|
| //Specify function that will be executed to display results
| ajax.onCompletion = createResults;
|
| //Execute AJAX function
| ajax.runAJAX();
| }
| }
|
| function createResults()
| {
| var obj = document.getElementById('result');
|
| //Executing the response from Ajax as Javascript code
| //Sent from php as an escaped string so must escape
| alert(unescape(ajax.response));
| eval(unescape(ajax.response));
| }
|
| </script>
| <!-- END AJAX for processing customer name search -->
|
|
| <table>
| <tr>
| <td><b>Customer Name:</b></td>
| <td>
| <input class="cust" id="search" name="search" type="text"
| onchange="searchInput(this)">
| </td>
| </tr>
| <tr>
| <td>&nbsp;</td>
| <td><select multiple size="10" id="result" name="result">
|
| </select>
| </td>
| </tr>
| </table>
---------------------------------------------------------------
jn******@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
Feb 28 '07 #10

P: n/a
On Feb 28, 12:02 am, Jeff North <jnort...@yahoo.com.auwrote:
On 27 Feb 2007 15:12:53 -0800, in comp.lang.javascript
trp...@gmail.com

<1172617973.224488.68...@k78g2000cwa.googlegroups. comwrote:
| Ok, Here is the code for what I am doing, and the ajax library being
| used is SACK fromhttp://twilightuniverse.com/projects/sack/I just
| can't seem to pass more than about 6100 characters... Any ideas, or a
| better way to go?

I recommend POSTing your form that way there is virtually no limit on
the input size.
| <?php
|
| //If some search criteria was sent
| if(isset($_GET['searchCriteria']))
| {
|
| //////////////////////////////// DB
| Connection ///////////////////////////////////////////////////////
| //////////////////////////////////////////////////////////////////////////////////////////////////////
|
| include('./adodb/adodb.inc.php');
|
| //Type of connection
| $db = NewADOConnection('oci8');
|
| //Sets the query results to come back as assoc arrays
| $db->SetFetchMode(ADODB_FETCH_ASSOC);
|
| //Make the connection
| $db->PConnect('xxxxx', 'yyyyy', 'zzzzz');
|
|
|
| //////////////////////////////////////////////////////////////////////////////////////////////////////
|
| $rs = $db->Execute("SELECT DISTINCT ID, NAME FROM PEOPLE WHERE
| UPPER(NAME_DISPLAY) LIKE '".$_GET['searchCriteria']."%'");
|
| $results = null;
| while ($arr = $rs->FetchRow()) {
| echo "obj.options[obj.options.length] = new
| Option('".rawurlencode($arr["NAME"])."','".rawurlencode($arr["ID"])."');
| \n";
| }
|
| exit;
| }
|
| ?>
|
| <link href="style.css" rel="stylesheet" type="text/css" />
|
| <!-- AJAX for processing customer name search -->
| <script type="text/javascript" src="ajax.js"></script>
| <script type="text/javascript">
|
| var ajax = new sack();
|
| function searchInput(input)
| {
| //Set a variable to hold the value from the form input field
| var searchCriteria = input.value;
|
| //Empty results select box
| document.getElementById('result').options.length = 0;
|
| //If there is search criteria, then process
| if(searchCriteria.length>0)
| {
| //Pass to php to process
| ajax.requestFile = 'tst2.php?searchCriteria='+searchCriteria;
|
| //Specify function that will be executed to display results
| ajax.onCompletion = createResults;
|
| //Execute AJAX function
| ajax.runAJAX();
| }
| }
|
| function createResults()
| {
| var obj = document.getElementById('result');
|
| //Executing the response from Ajax as Javascript code
| //Sent from php as an escaped string so must escape
| alert(unescape(ajax.response));
| eval(unescape(ajax.response));
| }
|
| </script>
| <!-- END AJAX for processing customer name search -->
|
|
| <table>
| <tr>
| <td><b>Customer Name:</b></td>
| <td>
| <input class="cust" id="search" name="search" type="text"
| onchange="searchInput(this)">
| </td>
| </tr>
| <tr>
| <td>&nbsp;</td>
| <td><select multiple size="10" id="result" name="result">
|
| </select>
| </td>
| </tr>
| </table>

---------------------------------------------------------------
jnort...@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
Yes do Post-ing with <?php ob_start('ob_gzhandler');?in your PHP
file. This will compress your data.

Feb 28 '07 #11

This discussion thread is closed

Replies have been disabled for this discussion.