473,387 Members | 1,693 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,387 software developers and data experts.

Script doesn't work without alerts :(

Hey
var service = this.WebServiceURL +"/SessionFun?sessionID="+ this.SessionID ;

var xmlDoc=document.implementation.createDocument("", "", null);
try

{

xmlDoc.async = false;

xmlDoc.load(service);

alert("now it works");

}

When you delete last alert the xmlDoc in older browser will be empty :( I
tried to put a pause there I wrote a code that just stops browser for 1, 2,
10 seconds... but the xmlDoc is still empty. And if I hit an alert after 0,1
s it works. How to make it work without alert ?

Jarod

Jan 5 '06 #1
10 6529
> Hey
var service = this.WebServiceURL +"/SessionFun?sessionID="+ this.SessionID
;

var xmlDoc=document.implementation.createDocument("", "", null);
try

{

xmlDoc.async = false;

xmlDoc.load(service);

alert("now it works");

}

When you delete last alert the xmlDoc in older browser will be empty :( I
tried to put a pause there I wrote a code that just stops browser for 1,
2, 10 seconds... but the xmlDoc is still empty. And if I hit an alert
after 0,1 s it works. How to make it work without alert ?

I forgot to mention that it doesn't work in NN 7.0.In higher versions like
NN 8.0 and FF 1,5 works great.
Jarod

Jan 5 '06 #2
>>When you delete last alert the xmlDoc in older browser will be empty :( I
tried to put a pause there I wrote a code that just stops browser for 1,
2,
10 seconds... but the xmlDoc is still empty.


What sort of code did you write to stop the browser?
Unless you used setTimeout(), you probably stopped your browser from doing
anything at all, including loading the document.


it doesn't matter I tried to use some pause function with while I tried
setTimeout doesn't matter. And it can take even 10s and doesn't help. But
one alert for 0,05s is great. Maybe there is a way to display and close
alert from code ?
Jarod

Jan 5 '06 #3
VK

Jarod wrote:
When you delete last alert the xmlDoc in older browser will be empty :( I
tried to put a pause there I wrote a code that just stops browser for 1,
2,
10 seconds... but the xmlDoc is still empty.


What sort of code did you write to stop the browser?
Unless you used setTimeout(), you probably stopped your browser from doing
anything at all, including loading the document.


it doesn't matter I tried to use some pause function with while I tried
setTimeout doesn't matter. And it can take even 10s and doesn't help. But
one alert for 0,05s is great. Maybe there is a way to display and close
alert from code ?


First of all,
async = true
*always and forever*

Synchronized requests simply do not work in JavaScript without real
thread management mechanics. More correctly - they do "work" but it's
far away from what you would call "work" for a synchronized process.
So simply forget that this flag exists (default value is true, exactly
what you need). For request status there is readyState property, so you
have to emulate *normal* synchronization manually over
onreadystatechange. Thank you very much to script engine makers (on
both sides), but what is - it is.

Secondly: it is forbidden by the rules of this universe :-) what
synchronized thread "works" upon alert(), and upon alert() only. That
must be a combined bug where several errors are twisted together. More
code would help.

Also it may be connected with alert() call priority so system let it go
through or even changes async from true to false. That's a *pure
speculation* as async=true behavior is studied rather badly (as no one
uses it).

Jan 5 '06 #4
>> it doesn't matter I tried to use some pause function with while I tried
setTimeout doesn't matter. And it can take even 10s and doesn't help. But
one alert for 0,05s is great. Maybe there is a way to display and close
alert from code ?
First of all,
async = true
*always and forever*


I tried it before writting to group nothing changed. With alert it works
without alert it doesn't.
Also it may be connected with alert() call priority so system let it go
through or even changes async from true to false. That's a *pure
speculation* as async=true behavior is studied rather badly (as no one
uses it).


Any ideas how to make it work ?
Jarod

Jan 5 '06 #5
>>>>When you delete last alert the xmlDoc in older browser will be empty
:( I
tried to put a pause there I wrote a code that just stops browser for 1,
2,
10 seconds... but the xmlDoc is still empty.

What sort of code did you write to stop the browser?
Unless you used setTimeout(), you probably stopped your browser from
doing
anything at all, including loading the document.


it doesn't matter I tried to use some pause function with while I tried
setTimeout doesn't matter. And it can take even 10s and doesn't help. But
one alert for 0,05s is great. Maybe there is a way to display and close
alert from code ?


No. How did you try to use setTimeout()?


For real it doesn't matter because it doesn't work in anyway.
But let's say:

xmlDoc.onload = window.setTimeout(...);
without using xmlDoc.onload... just after xmlDoc.load()
window.setTimeout(...)
Of course non of them helped ( but it worked code was paused ).
Jarod

Jan 5 '06 #6
VK

Jarod wrote:
Any ideas how to make it work ?


If by "it" you mean the originally posted piece:

var service = this.WebServiceURL +"/SessionFun?sessionID="+
this.SessionID ;
var xmlDoc=document.implementation.createDocument("", "", null);
try
{
xmlDoc.async = false;
xmlDoc.load(service);
alert("now it works");
}

then no one knows I guess because there is nothing explicetly terrible
in it, but "this.WebServiceURL" suggests that this is a part of a
constructor we have no idea about. So please either post the code or
provide a link.

Jan 5 '06 #7
> If by "it" you mean the originally posted piece:

var service = this.WebServiceURL +"/SessionFun?sessionID="+
this.SessionID ;
var xmlDoc=document.implementation.createDocument("", "", null);
try
{
xmlDoc.async = false;
xmlDoc.load(service);
alert("now it works");
}

then no one knows I guess because there is nothing explicetly terrible
in it, but "this.WebServiceURL" suggests that this is a part of a
constructor we have no idea about. So please either post the code or
provide a link.


this.WebServiceURL = http://localhost/myWebservice.asmx;
and this code as a whole not this peace works in all new browsers but it
doesn't in NN 7.0.
If I add "alert("");" like in above it works in NN 7.0. Question is how to
make it work without alert.
Jarod

Jan 5 '06 #8
"Jarod" <bl*****@NOSPAM.gazeta.pl> writes:
xmlDoc.async = false;
xmlDoc.load(service);
alert("now it works");
If I add "alert("");" like in above it works in NN 7.0. Question is
how to make it work without alert.


If adding alert changes anything, it suggests a timing problem.
The "xmlDoc.async = false" assignment suggests that something
could happen asynchroneously. If it did, then maybe a delay is
needed, so my suggestion would be that the assignment fails to
make the request synchroneous in NN7. You could live with that
and change it to always be asynchroneous, or you could look
for a workaround for NN7 (as well as a way to safely detect
the need for that workaround).

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jan 6 '06 #9
>>> xmlDoc.async = false;
xmlDoc.load(service);
alert("now it works");

If I add "alert("");" like in above it works in NN 7.0. Question is
how to make it work without alert.


If adding alert changes anything, it suggests a timing problem.
The "xmlDoc.async = false" assignment suggests that something
could happen asynchroneously. If it did, then maybe a delay is
needed, so my suggestion would be that the assignment fails to
make the request synchroneous in NN7. You could live with that
and change it to always be asynchroneous, or you could look
for a workaround for NN7 (as well as a way to safely detect
the need for that workaround).


Async set to true doesn't change anything ;( I tried it. But I don't know
why this alert makes it work ? [It's probably not about time... but about
some interuption ...]
Jarod

Jan 6 '06 #10
VK

Jarod wrote:
Async set to true doesn't change anything ;( I tried it. But I don't know
why this alert makes it work ? [It's probably not about time... but about
some interuption ...]


Netscape 7.x is mainly forgotten beast. But here a very similar code
claimed to work for Netscape 7.x:
<http://www.stylusstudio.com/xsllist/200411/post50020.html>

and here is a working sample of this code:
<http://users.telenet.be/cking/webstuff/dynamic-xslt/dynamic.html>

It works for Firefox 1.5, check it for your Netscape.

Jan 7 '06 #11

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

Similar topics

8
by: Johnny Knoxville | last post by:
I've added a favicon to my site (http://lazyape.filetap.com/) which works fine if you add the site to favourites the normal way, but I have some JavaScript code on a couple of pages with a link,...
2
by: kaeli | last post by:
Okay, trying to get the for...in loop syntax and obviously doing something wrong. I have a form and a select with options. The explicit indexing I usually use works fine and alerts all the...
15
by: AV | last post by:
Hallo any idea why the following code doesn't work? ////////////////////////////////// function myfunc(){ with(this){ prop="hallo world"; } }
5
by: zaw | last post by:
Hi I am working on implementing this script to shopping cart. Basically, it copies fill the shipping address from billing automatically. I believe one or more syntax is not netscape compatible....
0
by: Pete Beech | last post by:
Hi, We have an ASP.NET 1.1 webapp, deployed on an integration and a production server - exactly the same code. One of the pages has client side validation script, using the validation...
7
by: C.Joseph Drayton | last post by:
I have a problem that I am hoping someone can help me with. First let me describe the problem. I have an HTML form that in one field has an onBlur call to a JavaScript function. When you exit the...
7
by: mattrapoport | last post by:
Hello - I am kinda new to the HTML DOM so I apologize in advance for my ignorance. I have a table made from divs. I am trying to write a script that appends a new row to the table (by cloning...
19
by: thisis | last post by:
Hi All, i have this.asp page: <script type="text/vbscript"> Function myFunc(val1ok, val2ok) ' do something ok myFunc = " return something ok" End Function </script>
28
by: Peter Michaux | last post by:
Hi, I'm playing with dynamic script insertion to make a request to the server for a JavaScript file to be automatically run when it arrives in the browser. It works but... The page caching...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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...

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.