could not understand one line i.e, handleServerResponse; (ajax tutorial)

+1 Inzamam Tahir · January 21, 2015
The code that was given in video completely worked but I could not understand why it worked because it seemed to me that there was an error and I tried to correct it but found out that I was wrong but don't know why. The issue is in the file foodstore.js on the line                           

 xmlHttp.onreadystatechange = handleServerResponse;

In that line, handleServerResponse is basically a function and when calling a function in javascript , shouldn't there be empty roundbrackets at the end ??  like this:

xmlHttp.onreadystatechange = handleServerResponse();

but when I added the brackets, the code stopped working. Why ??????????????

Post a Reply


Oldest  Newest  Rating
0 Inzamam Tahir · January 21, 2015
Well, I found the answer to answer to my own question. I am also posting the link to the solution, in case, someone else is having the same issue
  • 1



A scripting language that is added to standard HTML to create interactive effects, apps, games for the browser.