473,397 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

ajax.response max size

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
11 9832
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
بسم الله الرحمن الرحيم
افضل موقع للتعارف بين الجنس ين الشباب والبنات من كل دول العالم
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
بسم الله الرحمن الرحيم
افضل موقع للتعارف بين الجنس ين الشباب والبنات من كل دول العالم
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
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
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
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
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
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
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
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
Hello,

on 02/23/2007 10:48 PM tr****@gmail.com said the following:
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?
You may want to take a look at this class that comes with a plug-in
named linked select that links 2 or more select inputs populating each
select input using option values retrieved from a database with AJAX.

http://www.phpclasses.org/formsgeneration

Here is the live example script that demonstrates what you want:

http://www.meta-language.net/forms-e..._linked_select

Here you can see a video of the part of this class tutorial that
explains the linked select input plug-in:

http://www.phpclasses.org/browse/vid...ed-select.html
--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
Mar 4 '07 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: evgenyg | last post by:
Hello ! We have the following situation - when Ajax request is sent what's being returned by the server is usually an XML (which is used for DOM updates) but sometimes it's HTML which is a whole...
10
by: trpost | last post by:
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...
1
by: quill | last post by:
Hi I am making a chatroom script and it appears that the problem seems to be that my setTimeout's are conflicting. The logic is as follows: Run a login check every x seconds Run a trigger...
13
by: adam | last post by:
Hey All, I'm relatively new to all this and any help would be appreciated. What I'm aiming to do is create a few requests, to 1. Search for a Student against XML created from the database 2. If...
0
by: BlipBlip | last post by:
Hi All, I was not sure which forum to post the message to since the problem related to ASP/AJAX, but decided to post it here. I have a simple routine which utilizes an Ajax to query database for...
0
by: Tarik Monem | last post by:
I have been working on an all AJAX/DOM web site which is set to go live today and I thought I'd share my discoveries with all of you whom have helped me when I have encountered different issues along...
4
by: srkidd12 | last post by:
Hello, I am having problems with using AJAX to call information to my primary ASP page from a secondary asp page that brings in the data I want to display. I'm having the onfocus event trigger...
7
by: Jim in Arizona | last post by:
I'm brand new at ajax. In fact, about 20 minutes ago was the first time I got it to work. The problem I'm having on another page did not work, however. I'm running into the following error: ...
11
by: ziycon | last post by:
Ok, I've gone through the code at http://www.webtoolkit.info/ajax-file-upload.html and I'm totally lost, haven't got a clue what it does and wher eit should be added!?! So i have: <html>...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.