473,699 Members | 2,933 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XMLHttpRequest - unterminated string constant javascript error

I have the following javascript function that updates a scroll_list and
sends the updated entry (with its index) to a server script
( i.e. http://mkmxg00/cgi/confirmUpload.pl ) for further processing:

function saveText( scroll_list, t_area, listToBeUpdated ) {
scroll_list.opt ions[scroll_list.sel ectedIndex].text = t_area.text;
scroll_list.opt ions[scroll_list.sel ectedIndex].value= t_area.value;

var req;
var url = "http://mkmxg00/cgi/confirmUpload.p l";

if ( window.XMLHttpR equest ) {
try {
req = new XMLHttpRequest( );
}
catch( e ) {
req = false;
}
}
else if ( window.ActiveXO bject ) {
try {
req = new ActiveXObject( "Msxml2.XMLHTTP " );
}
catch( e ) {
try {
req = new ActiveXObject( "Microsoft.XMLH TTP" );
}
catch( e ) {
req = false;
}
}
if ( req ) {
req.onreadystat echange = processReqChang e;
req.open( "POST", url, true );

// req.send( null );

req.send( "client side" );
req.send( "2nd piece of data from client side: " + i + "\n" );
}
}
}

function processReqChang e() {
alert( req.readyState );
if ( req.readyState == 4 ) {
if ( req.status == 200 ) {
// process the response if successful
alert( "passed!" );
}
}
else {
alert( req.readyState + ", " + req.status );
}
}
I tried the following reference:
http://www.xml.com/pub/a/2005/02/09/...p-request.html

My questions:
1) what caused the "unterminat ed string constant error"? I don't see any
', \r, etc in my javascript variables.

2) If I want to send() to the server the scroll_list option, and that
option's index to the server script http://mkmxg00/cgi/confirmUpload.pl
for further processing, am I using send() correctly? If not, please
correct by providing an example.

Jan 24 '06 #1
18 7326
William wrote:
[...]
if ( req ) {
req.onreadystat echange = processReqChang e;
req.open( "POST", url, true );
XMLHttpRequest. prototype.open( ) is described to clear all event listeners,
so you should switch the order of the last two statements.

<URL:http://xulplanet.com/references/objref/XMLHttpRequest. html#method_ope n>
// req.send( null );

req.send( "client side" );
req.send( "2nd piece of data from client side: " + i + "\n"
);
}
[...]
I tried the following reference:
http://www.xml.com/pub/a/2005/02/09/...p-request.html
You better look at the source: see

<URL:http://msdn.microsoft. com/library/en-us/xmlsdk/html/7924f6be-c035-411f-acd2-79de7a711b38.as p>

and the URI above.
My questions:
1) what caused the "unterminat ed string constant error"? I don't see any
', \r, etc in my javascript variables.
The code you posted is syntactically correct. The error must be elsewhere.
Since you did not post how you call the saveText() method, it is possible
that the method call creates the problem.

<URL:http://jibbering.com/faq/#FAQ4_43>
2) If I want to send() to the server the scroll_list option, and that
option's index to the server script http://mkmxg00/cgi/confirmUpload.pl
for further processing, am I using send() correctly?
No. It does not make sense to make several independent asynchronous POST
requests to the same resource without changing the event listener. You
should get informed about HTTP; read RFC1945 and RFC2616.
If not, please correct by providing an example.


req.send(
"client side"
+ "2nd piece of data from client side: " + i + "\n");

BTW: This is the fourth thread started by you dealing with the same main
problem. I would appreciate it -- and I am sure I am not the only one here
-- if you would not start a new thread unless the main problem to be solved
changes significantly; instead please continue the existing thread (post a
followup). RT[fp]ineM or use a newsreader application that you can handle
instead.
PointedEars
Jan 24 '06 #2
On Tue, 24 Jan 2006, Thomas 'PointedEars' Lahn wrote:
William wrote:
[...]
if ( req ) {
req.onreadystat echange = processReqChang e;
req.open( "POST", url, true );
XMLHttpRequest. prototype.open( ) is described to clear all event listeners,
so you should switch the order of the last two statements.


I switched the order of the last 2 statements. Unfortunately I got the
same error.

<URL:http://xulplanet.com/references/objref/XMLHttpRequest. html#method_ope n>
// req.send( null );

req.send( "client side" );
req.send( "2nd piece of data from client side: " + i + "\n"
);
}
[...]
I tried the following reference:
http://www.xml.com/pub/a/2005/02/09/...p-request.html
You better look at the source: see

<URL:http://msdn.microsoft. com/library/en-us/xmlsdk/html/7924f6be-c035-411f-acd2-79de7a711b38.as p>

and the URI above.


i have already read this MSDN reference before posting.
My questions:
1) what caused the "unterminat ed string constant error"? I don't see any
', \r, etc in my javascript variables.


The code you posted is syntactically correct. The error must be elsewhere.
Since you did not post how you call the saveText() method, it is possible
that the method call creates the problem.


saveText() was called in the following 2 places:

print $query->td(
$query->textarea(-name=>'BOFOTick ers'),
$query->p,
$query->button(-name=>'ADD',
-value=>'Confirm Modifications',
-onClick=>"saveT ext( this.form.bo_fo _tickers,
this.form.BOFOT ickers, this.form.bo_fo _tickers )"),
$query->button(-name=>'REMOVE',
-value=>'Edit Selected Entry',
-onClick=>"edit( this.form.bo_fo _tickers,
this.form.BOFOT ickers)"));

print $query->td(
$query->textarea(-name=>'BOFOEmai ls'),
$query->p,
$query->button(-name=>'ADD',
-value=>'Confirm Modifications',
-onClick=>"saveT ext( this.form.bo_fo _emails,
this.form.BOFOE mails, this.form.bo_fo _emails )"),
$query->button(-name=>'REMOVE',
-value=>'Edit Selected Entry',
-onClick=>"edit( this.form.bo_fo _emails,
this.form.BOFOE mails)"));
<URL:http://jibbering.com/faq/#FAQ4_43>

also read this URL before posting; but the line number and character given
in the javascript error message is wrong - it refers to an unrelated place
in my source code file.

The error is intermittent - sometimes even when the page loads up, I got
the same javascript unterminated string constant error.
Jan 25 '06 #3
William wrote:
On Tue, 24 Jan 2006, Thomas 'PointedEars' Lahn wrote:
William wrote:
[...]
if ( req ) {
req.onreadystat echange = processReqChang e;
req.open( "POST", url, true );


XMLHttpRequest. prototype.open( ) is described to clear all event
listeners, so you should switch the order of the last two statements.


I switched the order of the last 2 statements. Unfortunately I got the
same error.


It was a Good Thing anyway.
[...]
My questions:
1) what caused the "unterminat ed string constant error"? I don't see
any ', \r, etc in my javascript variables.


The code you posted is syntactically correct. The error must be
elsewhere. Since you did not post how you call the saveText() method, it
is possible that the method call creates the problem.


saveText() was called in the following 2 places:

[probably server-side code]


Whatever this is, it is not JS/ECMAScript. Post client-side code if you
have a problem with client-side scripting, and post only JS/ECMAScript code
here.
<URL:http://jibbering.com/faq/#FAQ4_43>

also read this URL before posting; but the line number and character given
in the javascript error message is wrong - it refers to an unrelated place
in my source code file.


Of course it is wrong. It is referring to the generated (client-side) code,
not the generating (server-side) one.
PointedEars
Jan 25 '06 #4
On Wed, 25 Jan 2006, Thomas 'PointedEars' Lahn wrote:

[...]
<URL:http://jibbering.com/faq/#FAQ4_43>

also read this URL before posting; but the line number and character given
in the javascript error message is wrong - it refers to an unrelated place
in my source code file.


Of course it is wrong. It is referring to the generated (client-side) code,
not the generating (server-side) one.


"unterminat ed string constant javascript error" occured on line 99,
character 5.

The client-side code would be the HTML page. But I tried view->source
from my brower, and my HTML code has only 48 lines. So where is this
"line 99, character 5" come from?

Jan 25 '06 #5
William said the following on 1/25/2006 10:36 AM:
On Wed, 25 Jan 2006, Thomas 'PointedEars' Lahn wrote:

[...]
<URL:http://jibbering.com/faq/#FAQ4_43>
also read this URL before posting; but the line number and character
given
in the javascript error message is wrong - it refers to an unrelated
place
in my source code file.


Of course it is wrong. It is referring to the generated (client-side)
code,
not the generating (server-side) one.


"unterminat ed string constant javascript error" occured on line 99,
character 5.

The client-side code would be the HTML page. But I tried view->source
from my brower, and my HTML code has only 48 lines. So where is this
"line 99, character 5" come from?


Do you have any external .css files or .js files referenced? Those lines
of code will be included when counting line numbers. The same as if you
had not used external files but pasted the contents into the HTML file.

If not, then post a URL to a sample page that shows the error.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 25 '06 #6
On Wed, 25 Jan 2006, Randy Webb wrote:
William said the following on 1/25/2006 10:36 AM:
On Wed, 25 Jan 2006, Thomas 'PointedEars' Lahn wrote:

[...]
> <URL:http://jibbering.com/faq/#FAQ4_43>
also read this URL before posting; but the line number and character
given
in the javascript error message is wrong - it refers to an unrelated
place
in my source code file.

Of course it is wrong. It is referring to the generated (client-side)
code,
not the generating (server-side) one.
"unterminat ed string constant javascript error" occured on line 99,
character 5.

The client-side code would be the HTML page. But I tried view->source from
my brower, and my HTML code has only 48 lines. So where is this "line 99,
character 5" come from?


Do you have any external .css files or .js files referenced? Those lines of
code will be included when counting line numbers. The same as if you had not
used external files but pasted the contents into the HTML file.


No .css nor .js files referenced.
If not, then post a URL to a sample page that shows the error.

http://mkmxg00/cgi/extra_desks_upload_list.pl

Jan 25 '06 #7
William said the following on 1/25/2006 11:00 AM:
On Wed, 25 Jan 2006, Randy Webb wrote:
William said the following on 1/25/2006 10:36 AM:
On Wed, 25 Jan 2006, Thomas 'PointedEars' Lahn wrote:

[...]

>> <URL:http://jibbering.com/faq/#FAQ4_43>
> also read this URL before posting; but the line number and
> character given
> in the javascript error message is wrong - it refers to an
> unrelated place
> in my source code file.

Of course it is wrong. It is referring to the generated
(client-side) code,
not the generating (server-side) one.

"unterminat ed string constant javascript error" occured on line 99,
character 5.

The client-side code would be the HTML page. But I tried
view->source from my brower, and my HTML code has only 48 lines. So
where is this "line 99, character 5" come from?


Do you have any external .css files or .js files referenced? Those
lines of code will be included when counting line numbers. The same as
if you had not used external files but pasted the contents into the
HTML file.


No .css nor .js files referenced.
If not, then post a URL to a sample page that shows the error.

http://mkmxg00/cgi/extra_desks_upload_list.pl


I get a Page Not Found for that URL.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 25 '06 #8
William wrote:
On Wed, 25 Jan 2006, Randy Webb wrote:
William said the following on 1/25/2006 10:36 AM:
On Wed, 25 Jan 2006, Thomas 'PointedEars' Lahn wrote:
>> <URL:http://jibbering.com/faq/#FAQ4_43>
> also read this URL before posting; but the line number and character
> given in the javascript error message is wrong - it refers to an
> unrelated place in my source code file.
Of course it is wrong. It is referring to the generated (client-side)
code, not the generating (server-side) one.
"unterminat ed string constant javascript error" occured on line 99,
character 5.
The client-side code would be the HTML page. But I tried view->source
from my brower, and my HTML code has only 48 lines. So where is this
"line 99, character 5" come from?

Do you have any external .css files or .js files referenced? Those lines
of code will be included when counting line numbers. The same as if you
had not used external files but pasted the contents into the HTML file.


No .css nor .js files referenced.


Is the generated source code valid markup (<URL:http://validator.w3.or g/>)
Are there any other `link' or `script' elements in your client-side source
code? If yes, which ones? Which user agent(s) are you testing with (post
the name and version along with the value of navigator.userA gent)?
If not, then post a URL to a sample page that shows the error.


http://mkmxg00/cgi/extra_desks_upload_list.pl

^^^^^^^
A _fully qualified_ domain name would have been helpful.
PointedEars
Jan 25 '06 #9
On Wed, 25 Jan 2006, Thomas 'PointedEars' Lahn wrote:
William wrote:
On Wed, 25 Jan 2006, Randy Webb wrote:
William said the following on 1/25/2006 10:36 AM:
On Wed, 25 Jan 2006, Thomas 'PointedEars' Lahn wrote:
>>> <URL:http://jibbering.com/faq/#FAQ4_43>
>> also read this URL before posting; but the line number and character
>> given in the javascript error message is wrong - it refers to an
>> unrelated place in my source code file.
> Of course it is wrong. It is referring to the generated (client-side)
> code, not the generating (server-side) one.
"unterminat ed string constant javascript error" occured on line 99,
character 5.
The client-side code would be the HTML page. But I tried view->source
from my brower, and my HTML code has only 48 lines. So where is this
"line 99, character 5" come from?
Do you have any external .css files or .js files referenced? Those lines
of code will be included when counting line numbers. The same as if you
had not used external files but pasted the contents into the HTML file.


No .css nor .js files referenced.


Is the generated source code valid markup (<URL:http://validator.w3.or g/>)
Are there any other `link' or `script' elements in your client-side source
code? If yes, which ones? Which user agent(s) are you testing with (post
the name and version along with the value of navigator.userA gent)?
If not, then post a URL to a sample page that shows the error.


http://mkmxg00/cgi/extra_desks_upload_list.pl

^^^^^^^
A _fully qualified_ domain name would have been helpful.

http://mkmxg00.cibg.tdbank.ca/cgi/ex...upload_list.pl

Jan 25 '06 #10

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

Similar topics

3
28428
by: noViagraHere | last post by:
What do i need to add to the document line to stop getting an Unterminated String Constant error? itemtocheck = '1300'; document.writeln('<!--#include virtual="checkQty.cgi?item='+itemtocheck+'"-->');
5
5712
by: KathyB | last post by:
Hi, this is the first lines of a function. Although it runs, it still throws an "Unterminated string constant" error in the browser. It is all in one line, just wouldn't fit here. The error appears to occur right after type='+typeIn+'&id <----before the = Any clues appreciated! Thanks, Kathy
6
13486
by: Jeff | last post by:
Hi, does anyone know why this: <a onclick="insertatcaret(window.opener.document.formname.fieldname,'<td class="header">')">text</a> returns a "Unterminated String Constant" error message in IE 6.0 but if I take out the double quotes around header it does not? I need double quotes around header, I thought this was possible in javascript so long as the pair of double quotes is surrounded by a pair of single quotes.
3
4108
by: aroraamit81 | last post by:
Hi, I am facing a problem in javascript. strdata is a variable of javascript and following is an assignment( hmmmmmmmmmmm a Huge one but unfortunately its not mine code, I am just trying to rectify it) to this varibale.. Now I am facing a run time error(Unterminated string constant). Can any one please help me solving this bug. strdata +="<tr <% if functionality_add = 0 and functionality_edit = 0
2
2658
by: Tav | last post by:
this seems to be a very generic error message, and the fact that i have no way of locating what causes the error is frustrating. anyway, i'll be general with my problem. i have a div on my page that contains some information, and i made it like a window, as in it can be maximized and closed by javascript functions in the page. the function operates on only one argument, and that is whether the visitor is maximizing or restoring the...
2
16914
by: polilop | last post by:
When i open my page in IE it shows an error Unterminated string constant om Line..... When i look at the line it shows the line where the </SCRIPT> tag is ???? Moziila dose not see this error, allso avant browser (shell for IE) dosent see it. the script works fine, i'm just anoyed with IE calling errors. Anybody know why this is?
5
3636
Chrisjc
by: Chrisjc | last post by:
I Have no IDEA what this error code means on my page.. I have chech the lines listed and just doesnt add up.. here is the error Line: 11 Char: 38 Error: Unterminated string constant Code: 0 URL: IntakeSystemstest.php and here is the code starting from line 1 to line 30
2
3115
by: rajuk | last post by:
Hi i have following code,when i execute this code i got unterminated string constant error.any javascript guru can you look into this please. raju /* The link details */ var links = new Array ("link1", "link2", "link3"); var links_text = new Array ("Link 1", "Link 2", "Link 3"); var links_url = new Array ("link1.htm", "link2.htm","link3.htm"); /* Resolve the location */ var loc=String(this.location);
3
4200
hemantbasva
by: hemantbasva | last post by:
i have written a the following javascript code to copy data onto clipboard but i am getting error Unterminated string constant code in cs file if (lblProcedureID != null) { lnkHold.Attributes.Add("onclick", "javascript:copyText('Procedure Id-" + lblProcedureID.Text + " Proceudre Title-" + ProcedureTitle.Text + " Procedure Description-" + ProcedureDesc.Value + "');"); ...
0
8623
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9187
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...
0
9053
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8936
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
8894
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
5879
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
4390
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...
1
3071
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
2360
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.