Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Synchronous JScript POST functions?

Reply
Thread Tools

Synchronous JScript POST functions?

 
 
Brad
Guest
Posts: n/a
 
      02-02-2005
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?

 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      02-02-2005


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.XMLHTTP')
) 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.open('POST', 'whatever.php', true);
is asynchronously (preferred way but needs an onreadystatechange event
handler) while
httpRequest.open('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/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference between synchronous (proactor pattern) and synchronous model in web server Rickert C++ 0 10-06-2011 04:54 AM
What is Server-Side Jscript (not Jscript.NET)? Maxwell2006 ASP .Net 5 03-07-2006 05:28 AM
JScript.Net (JScript 7.0) is official documented language VK Javascript 4 01-12-2006 06:48 PM
Porting from JScript to JScript.Net - compiler error Jon Maz ASP .Net 4 09-09-2004 10:24 AM
Which to Learn: Javascript, Jscript, JScript.NET, ECMA 262 (3rd ed)? John Bentley Javascript 14 02-05-2004 06:14 PM



Advertisments