Saturday, April 1, 2023
Learning Code
  • Home
  • JavaScript
  • Java
  • Python
  • Swift
  • C++
  • C#
No Result
View All Result
  • Home
  • JavaScript
  • Java
  • Python
  • Swift
  • C++
  • C#
No Result
View All Result
Learning Code
No Result
View All Result
Home JavaScript

Some questions about my JavaScript codes – General Web Dev – SitePoint Forums

learningcode_x1mckf by learningcode_x1mckf
November 28, 2022
in JavaScript
0
Time limit for notify – JavaScript – SitePoint Forums
74
SHARES
1.2k
VIEWS
Share on FacebookShare on Twitter


Beneath are my AJAX code snippet.
In rescanNetwork(), there are two calls of newAJAXCommand(). The primary one “newAJAXCommand(‘scan.cgi?scan=1’);” The second is “setTimeout(“newAJAXCommand(‘standing.xml’, updateStatus, false)”, 50)”
The content material of scan.cgi is form of “Success! scan”. My questions are:

  1. Per my understanding, scan.cgi have to be a CGI script written in Perl, Python, or one other scripting language. “Success! scan” doesn’t seem like a script of any language. How come? What does it imply?
  2. What is that this name “newAJAXCommand(‘standing.xml’, updateStatus, false)” for? the place ‘updateStatus’ is a JavaScript operate as under.
  3. In “newAJAXCommand”, as soon as “newAjax.ajaxReq.ship(knowledge);” is executed, the server facet related operate have to be known as, however I discovered no operate was known as. How can I discover the lacking place?
// Initiates a brand new AJAX command
//  url: the url to entry
//  container: the doc ID to fill, or a operate to name with response XML (non-compulsory)
//  repeat: true to repeat this name indefinitely (non-compulsory)
//  knowledge: an URL encoded string to be submitted as POST knowledge (non-compulsory)
operate newAJAXCommand(url, container, repeat, knowledge)

    // Arrange our object
    var newAjax = new Object();
    var theTimer = new Date();
    newAjax.url = url;
    newAjax.container = container;
    newAjax.repeat = repeat;
    newAjax.ajaxReq = null;

    // Create and ship the request
    if (window.XMLHttpRequest) 
        newAjax.ajaxReq = new XMLHttpRequest();
        newAjax.ajaxReq.open((knowledge==null)?"GET":"POST", newAjax.url, true);
        newAjax.ajaxReq.ship(knowledge);
    // If we're utilizing IE6 model (perhaps 5.5 suitable too)
     else if (window.ActiveXObject) 
        newAjax.ajaxReq = new ActiveXObject("Microsoft.XMLHTTP");
        if (newAjax.ajaxReq) 
            newAjax.ajaxReq.open((knowledge==null)?"GET":"POST", newAjax.url, true);
            newAjax.ajaxReq.ship(knowledge);
        
    

    newAjax.lastCalled = theTimer.getTime();

    // Retailer in our array
    ajaxList.push(newAjax);


.......
operate updateStatus(xmlData)

    ......

.....

operate rescanNetwork()

    scanDots = 0;
    printButtonName();
    doc.getElementById("rescan").disabled = true;

    // Generate a request to {hardware} to subject a rescan
    newAJAXCommand('scan.cgi?scan=1');

    // Delete previous desk, substitute with new desk after scan is completed
    deleteScanTable();

    currBss = 0; // Reset the present bss pointer

    setTimeout("newAJAXCommand('standing.xml', updateStatus, false)", 50);

stanhuangtw:

Per my understanding, scan.cgi have to be a CGI script written in Perl, Python, or one other scripting language. “Success! scan” doesn’t seem like a script of any language. How come? What does it imply?

scan.cgi have to be one thing that an internet browser, pulling a typical HTTP request for the URL (Common Useful resource Locator) object referenced by ‘scan.cgi?scan=1’, acknowledges and returns one thing from. It’s very open to interpretation; usually, a CGI script would, certainly, be some type of script in a language to be run by the server’s processing features. But it surely doesnt should be. It may simply be some textual content that will get returned.

stanhuangtw:

What is that this name “newAJAXCommand(‘standing.xml’, updateStatus, false)” for? the place ‘updateStatus’ is a JavaScript operate as under.

Properly, setTimeout tells Javascript “wait this many milliseconds (50), after which run this line of code.” (you may additionally put a operate there, and so on).
newAJAXCommand(‘standing.xml’, updateStatus, false) says “Go get me standing.xml, set the container to the operate reference for updateStatus, and the repeat to false.” What do container and repeat do? Dunno. You havent present n us something that references these properties of that object.

stanhuangtw:

In “newAJAXCommand”, as soon as “newAjax.ajaxReq.ship(knowledge);” is executed, the server facet related operate have to be known as, however I discovered no operate was known as. How can I discover the lacking place?

ship on this case is a operate of the item (both the XMLHttpRequest object or the ActiveXObject relying on how previous your browser is…). It sends the request to truly go and do the speaking with the server. It’s a predefined operate of that object class, as is open.



Source link

You might also like

4 Packages for Working With Date and Time in JavaScript – MUO – MakeUseOf

Understanding the Power of Proxy in JavaScript – hackernoon.com

JavaScript vs. TypeScript: What's the difference? – TheServerSide.com

Share30Tweet19
learningcode_x1mckf

learningcode_x1mckf

Recommended For You

4 Packages for Working With Date and Time in JavaScript – MUO – MakeUseOf

by learningcode_x1mckf
April 1, 2023
0
Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

4 Packages for Working With Date and Time in JavaScript  MUO - MakeUseOf Source link

Read more

Understanding the Power of Proxy in JavaScript – hackernoon.com

by learningcode_x1mckf
April 1, 2023
0
Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

Understanding the Power of Proxy in JavaScript  hackernoon.com Source link

Read more

JavaScript vs. TypeScript: What's the difference? – TheServerSide.com

by learningcode_x1mckf
April 1, 2023
0
Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

JavaScript vs. TypeScript: What's the difference?  TheServerSide.com Source link

Read more

JetBrains updates IDEs for Java, JavaScript, Ruby – InfoWorld

by learningcode_x1mckf
March 31, 2023
0
Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

JetBrains updates IDEs for Java, JavaScript, Ruby  InfoWorld Source link

Read more

Virtru Announces First Ever FIPS 140-2 Validated JavaScript … – GlobeNewswire

by learningcode_x1mckf
March 30, 2023
0
Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

Virtru Announces First Ever FIPS 140-2 Validated JavaScript ...  GlobeNewswire Source link

Read more
Next Post
Why are shallow earthquakes more destructive? The West Java disaster is an example – Academia

Why are shallow earthquakes more destructive? The West Java disaster is an example - Academia

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Related News

An Intro to Algorithms and Data Structures (Javascript Edition)

An Intro to Algorithms and Data Structures (Javascript Edition)

September 17, 2022
Why your business should use Java and 7 strategies to hire top Java developers

Why your business should use Java and 7 strategies to hire top Java developers

November 17, 2022
Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

Should C/C++ be deprecated in favour of Rust? – Channel Asia Singapore

March 3, 2023

Browse by Category

  • C#
  • C++
  • Java
  • JavaScript
  • Python
  • Swift

RECENT POSTS

  • So why did they decide to call it Java? – InfoWorld
  • Senior Java Developer – IT-Online
  • 4 Packages for Working With Date and Time in JavaScript – MUO – MakeUseOf

CATEGORIES

  • C#
  • C++
  • Java
  • JavaScript
  • Python
  • Swift

© 2022 Copyright Learning Code

No Result
View All Result
  • Home
  • JavaScript
  • Java
  • Python
  • Swift
  • C++
  • C#

© 2022 Copyright Learning Code

Are you sure want to unlock this post?
Unlock left : 0
Are you sure want to cancel subscription?