Send() function question


#1

hello there,

I'm a bit confused, I just went over the hole course again and didn't understand the usability of the send() function.
we already sent the request with the "var.open("GET", "URL", false);" function, haven't we?

Oh and somthing more.. where can I find a detailed explanation about all the functions and arguments ajax using?

thanks,
moshe. :slightly_smiling:


#2

Hi Moshe!

I assume you're referring to the XMLHttpRequest methods open() and send(), which in this case are represented by xhr.open() and xhr.send().

It's quite normal in programming languages to separate the functions which prepare (xhr.open()) and send (xhr.send()) HTTP requests. There may be instances where you want to prepare a request but not necessarily send it yet.

The XMLHttpRequest object is the keystone of ajax programming, so if you want to know more about that object's methods and properties you could start by looking at W3Schools or the Mozilla Development Network.


#3

Hi flaky6,

I was also confused when I encountered the "NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'http://www.codecademy.com/' ". The mistake is in the Open() function "URL" argument which should be "https://www.codecademy.com/". I was using http://www.codecademy.com/ and I kept getting error, until i carefully checked the earlier example.

The instruction on codecademy says use "http://www.codecademy.com/" as the URL instead of this "https://www.codecademy.com/". So Codecademy need to correct that.


#4