474,044 Members | 25,203 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Passing strings between functions XMLHTTP.open

Hi,

I am using ajax to update a form. I call xmlHttp.open("G ET", strURL,
false).

The problem is that strURL is a really long string and it seems that
javascript craps out on this long string giving me an unspecified
error. I decided to test my theory and created a generic function to
pass over my url string and sure enough javascript dies with the same
error. I figured one way around it was to split my string into an
array and then join it up again but xmlHttp.open is not a method or
object I wrote, so I cant easily manipulate it.

Any thoughts on a way around this?

Regards,
Jeremiah
Jun 27 '08 #1
3 2193
On May 9, 9:59*am, jerm <jerm.hann...@g mail.comwrote:
Hi,

I am using ajax to update a form. *I call xmlHttp.open("G ET", strURL,
false).

The problem is that strURL is a really long string and it seems that
javascript craps out on this long string giving me an unspecified
error. *I decided to test my theory and created a generic function to
pass over my url string and sure enough javascript dies with the same
error. *I figured one way around it was to split my string into an
array and then join it up again but xmlHttp.open is not a method or
object I wrote, so I cant easily manipulate it.

Any thoughts on a way around this?

Regards,
Jeremiah
Have you tried using POST as your method? Not sure it would help but
you can also send the parameter string in the send method, rather than
appending to the url and sending one huge url:

xmlHttp.open("P OST", "http://www.myserver.co m/servlet/myServlet",
true);
xmlHttp.send("t his=that&this2= that2");

Just some things to think about. I have not run into a scenario where
I was sending a url string longer than 255 characters, so I'm sorry I
can't be of more assistance.

Jun 27 '08 #2
jerm wrote:
I am using ajax to update a form. I call xmlHttp.open("G ET", strURL,
false).

The problem is that strURL is a really long string and it seems that
javascript craps out on this long string giving me an unspecified
error.
Chances are that your crappy user agent and its API are the problem, not
"javascript ". For example, MSIE is known to support only 2083 characters
per URI: http://support.microsoft.com/kb/208427
I decided to test my theory and created a generic function to
pass over my url string and sure enough javascript dies with the same
error.
Which error?
I figured one way around it was to split my string into an
array and then join it up again but xmlHttp.open is not a method or
object I wrote, so I cant easily manipulate it.
It would not help you anyway. The URI needs to be complete in an HTTP
request. Read RFCs 1945 and 2616.
Any thoughts on a way around this?
As you cannot prevent people from using crappy UAs, and you cannot expect
the vendor of this particular crappy UA to get reasonable in no time, if
that, make a POST request instead.
PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
Jun 27 '08 #3
On May 9, 10:30*am, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
wrote:
jerm wrote:
I am using ajax to update a form. *I call xmlHttp.open("G ET", strURL,
false).
The problem is that strURL is a really long string and it seems that
javascript craps out on this long string giving me an unspecified
error.

Chances are that your crappy user agent and its API are the problem, not
"javascript ". *For example, MSIE is known to support only 2083 characters
per URI:http://support.microsoft.com/kb/208427
I decided to test my theory and created a generic function to
pass over my url string and sure enough javascript dies with the same
error.

Which error?
I figured one way around it was to split my string into an
array and then join it up again but xmlHttp.open is not a method or
object I wrote, so I cant easily manipulate it.

It would not help you anyway. *The URI needs to be complete in an HTTP
request. *Read RFCs 1945 and 2616.
Any thoughts on a way around this?

As you cannot prevent people from using crappy UAs, and you cannot expect
the vendor of this particular crappy UA to get reasonable in no time, if
that, make a POST request instead.

PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
You are correct thomas, I ended up just breaking down my url and
sending it in pieces. Thanks for your help!!!
jerm
Jun 27 '08 #4

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

Similar topics

3
15002
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) { document.images.src = eval("mt" +menu+ ".src") } alert("imgOff_hidemenu"); hideMenu=setTimeout('Hide(menu,num)',500);
2
1654
by: MJL | last post by:
I am working on a small project that involves the manipulation of dynamically allocated memory for strings. I was wondering why the string.h functions are the way they are and why not as follows: mystrcat(char** s1,char** s2); where s1's memory allocation can now be handled inside of the function and s2 can be freed and pointed to NULL inside the function. I'm not saying the built in functions are not useful as they are, but
1
4956
by: Ike | last post by:
Ive copied an online example for writing out a php file, programmatically, then would like to re-display that data in a browswer window that automatically refreshes as the data file (getdata.php, which is the file I am programmatically rewriting to elsewhere) gets changed. I am trying to use AJAX and JSON to do this. I have copied an example of using HttpRequest Object as the backbone of this from...
9
2396
by: balakrishnan.dinesh | last post by:
hi friends, Exactly what i want to know is, In my product we are using xmlhttp request to retrive some data from the server, And Im using IE browser, its working fine in IE. Now i want to work with netscape,I dont know how to pass the xmlhttp request in Netscape. i got some code like below for netscape for xmlhttp var oXML=new XMLHttpRequest();
2
1794
by: kasper48 | last post by:
Hello, I am using the following script to load content into a DIV tag on my webpage when an onclick calls the 'loadXMLDiv1' function...I am trying to add a section variable in the 'loadXMLDiv1' function ('divname') that will specify which Div ID to load the content into. This line: getObject(divname).innerHTML = req.responseText;
2
5896
by: Geoff Cox | last post by:
Hello, The code below is aimed at passing the date in the yyyyMMdd format from the javascript calendar in an html file to the php in a another file which then searches a MySQL database. For some reason the sendPhp is not working. I need to send
4
8310
by: sirjohnofthewest | last post by:
If I possessed the power to sway the mind of every user in the world to delete all forms of Internet Explorer I would die a happy man. Hi guys, I frequently visit this site to get answers to my problems and this one is really getting to me... I have a page that allows you to Browse Authors. There are three drop down boxes that auto-populate via AJAX. I have a file which it calls and returns the dynamically built XML file in the boxes...
3
1611
by: cbellew | last post by:
Hi guys, Let me just introduce my problem - i hope someone will be able to help! I have an index page for my site where i want the user to have the choice to view a login form or registration form. I have index.php with two links ("Click to login", "Click to Register"). I want to use ajax so that the user can switch between the forms without having to load the page. At the moment i have the forms stored in seperate html pages and i want...
7
2060
vikas251074
by: vikas251074 | last post by:
Can I assign value to cookies immediately after selecting a value from list? <select name="vlan_name" style="width:150px "> <%set rs = conn.execute("select vlan_name from vlan_master order by vlan_name") dim v_lan do while not rs.eof%> <option value="<%=rs("vlan_name")%>"><%=rs("vlan_name")%></option> <% rs.movenext loop%> </select>
0
10546
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
12140
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
12023
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
11141
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7869
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6652
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6837
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
5416
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4944
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.