473,667 Members | 2,650 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Synchronous JScript POST functions?

A long-time JScript/IE programmer friend of mine shared a technique
with me recently that puzzles me. He has a series of functions that
perform POSTs, with each function returning a dummy value. He has a
dummy variable in the calling code to catch it. He said that by both
returning and catching this dummy value, the POSTs perform
synchronously, whereas if there were no values caught in the calling
code, they would perform asychronously. Sort of like this:

var dummy1 = PostFunction1() ;
var dummy2 = PostFunction2() ;

where each PostFunctionX does a POST, and returns something like
'ignoreMe'.

I looked around and couldn't find any documentation detailing this
technique anywhere. Can someone point me to information about it? Or
shed light on other ways of accomplishing the same thing?

Jul 23 '05 #1
1 3794


Brad wrote:
A long-time JScript/IE programmer friend of mine shared a technique
with me recently that puzzles me. He has a series of functions that
perform POSTs, with each function returning a dummy value. He has a
dummy variable in the calling code to catch it. He said that by both
returning and catching this dummy value, the POSTs perform
synchronously, whereas if there were no values caught in the calling
code, they would perform asychronously. Sort of like this:

var dummy1 = PostFunction1() ;
var dummy2 = PostFunction2() ;

where each PostFunctionX does a POST, and returns something like
'ignoreMe'.

I looked around and couldn't find any documentation detailing this
technique anywhere. Can someone point me to information about it?


Not really, we need to guess, if you are talking about a HTTP POST then
I guess those functions (e.g. PostFunction1) which you didn't bother to
show us use MSXML (e.g.
var httpRequest = new ActiveXObject(' Microsoft.XMLHT TP')
) and then make a HTTP POST request with it, then there is no magic to
it as to whether processing is synchronous or asynchronous, the third
parameter of the open method determines that e.g.
httpRequest.ope n('POST', 'whatever.php', true);
is asynchronously (preferred way but needs an onreadystatecha nge event
handler) while
httpRequest.ope n('POST', 'whatever.php', false);
opens a synchronous requests (not preferred as it blocks the browser but
that gives you a way to have the script wait and return a value).
Docs are on http://msdn.microsoft.com/, look for MSXML.

But as said we need to guess, if those functions use/do something else
then obviously what I told you and pointed to you doesn't help, so
provide some details and then maybe we can identify what is done.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2

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

Similar topics

29
6012
by: Christopher Brandsdal | last post by:
If I have a .ASP page that runs JScript code - is it possible to include an ..ASP page that runs VBscript???
1
3410
by: Chris | last post by:
Hi. I have a ibrary I'm trying to use via javascript within IE. This library uses an asynchronous model where I call into a function and pass it a callback function as one of its arguments. My method returns immediately, and the callback function is called shortly thereafter... virtually immediately. I want to find a way to simplify my code by finding a way to simulate synchronous behavior for those functions. It's a little awkward...
1
1148
by: Rashad Rivera | last post by:
Hi Gang, My question is directed more towards the MS JSctip.NET dev team. I understand that you guys are planning to implement events in the newer versions of JS.NET, but is there a way to work around this problem now? I thought I could access a function in a HTA application by passing it into a JS.NET assembly. I learned of that it in exposed in the asm as an Object(AKA: System.__ComObject). But I am unable to cast it to a local...
7
3284
by: RFS666 | last post by:
Hello, I would like to use variables with a type in jscript.NET. I declare them as follows: var x : double = 5.03; This doesn't work in my script, that I write to the page in codebehind with "registerClientScriptBlock" as follows: string script = "<script language=jscript>"; script += "function test()";
9
3336
by: WRH | last post by:
Hello I am new to asp but I made some Jscript functions which work fine. The functions contain some strings used as a registration key for some apps. It is important that these strings not be visible to a client using a browser. My question is...can a knowledgeable browser user view Jscript source code in an asp file?
1
1454
by: RFS666 | last post by:
Hello together, I wanted to ask if somebody can help me with accessing a listbox (a serverside webform from the designer-toolbox) from clientside JScript. I need to add and remove values and find out about the selected index. I hope somebody can help & thanks in advance RFS666
2
2080
by: duncansinclair | last post by:
The following code works in IE, but in Forefox (1.0.7 & 1.5) the Asyncronous function (testA) works fine but the Synchronous one (testS) does not. It just doesn't work & I get no errors. Anybody have an idea why? <script> function testA () { var element = document.getElementById('show1'); if (window.XMLHttpRequest) {
3
9976
by: Pro1712 | last post by:
Hi, this may be a stupid question: How can I can call the DoWork-function of a BackgroundWorker synchronous? Or in other words: How can I extend the BackgroundWorker class with a function RunWorkerSync()?
0
1157
by: andrewwan1980 | last post by:
Sorry, all the code in my thread post is meant to be server-side. So if there is not a RUNAT="Server" in the SCRIPT tag then I just forgot and it should be written. Please have in mind this is all to do with server-side scripting. andrewwan1980 wrote: --
0
8459
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
8367
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
8889
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
8790
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...
0
5677
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
4202
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
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2781
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
2017
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.