473,397 Members | 1,985 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Function( confusion

Hi,

I'm a C++ programmer attempting to learn some basics of Javascript.

The following line is confusing me...

GDownloadUrl("/test.aspx", function(xmlData, responseCode)

.... with respect to the 2nd parameter in the method -
'function(xmlData'

What does this syntax mean exactly? I presume it means some thing of
an xmlData type, but being a C programmer, I'm not used to open
brackets '(' without a closing one!

If you could pass me a link to a Javascript reference that explains
this, that would be useful.

Thanks
Nov 2 '08 #1
8 1332
I think I have solved it. It's some dodgy code...

The person who wrote it put a huge function in the GDownloadUrl call

something like

GDownloadUrl("url", function(param1, param2) {

hundred or so lines of code...
}
);

Which really confused me!
Nov 2 '08 #2
BigDave wrote:
I think I have solved it. It's some dodgy code...
There is nothing dodgy about it.
The person who wrote it put a huge function in the GDownloadUrl call

something like

GDownloadUrl("url", function(param1, param2) {

hundred or so lines of code...
}
);

Which really confused me!
In ECMAScript implementations like in functional programming languages,
functions are first-class objects, and so may appear right-hand side of an
assignment and be used as function/method arguments. function(...) { ... }
is a function expression, and the resulting Function object is used as a
callback here. RTFM.
PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>
Nov 2 '08 #3
On 2 Nov, 16:16, Thomas 'PointedEars' Lahn <PointedE...@web.dewrote:
BigDave wrote:
I think I have solved it. It's some dodgy code...

There is nothing dodgy about it.
The person who wrote it put a huge function in the GDownloadUrl call
something like
GDownloadUrl("url", function(param1, param2) {
hundred or so lines of code...
}
);
Which really confused me!

In ECMAScript implementations like in functional programming languages,
functions are first-class objects, and so may appear right-hand side of an
assignment and be used as function/method arguments. *function(...) { .... }
is a function expression, and the resulting Function object is used as a
callback here. *RTFM.

PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
* -- from <http://www.vortex-webdesign.com/help/hidesource.htm>
The term 'dodgy code' was perhaps wrong, what I meant to say was it
could have been laid out better, but 'dodgy code' was the first term
that came to mind.

And you won't make any friends using terms like RTFM.


Nov 2 '08 #4
Ahh I see. I've read some of your previous messages. Consider yourself
erased from my personal universe *plonk*
Nov 2 '08 #5
BigDave wrote:
Ahh I see. I've read some of your previous messages. Consider yourself
erased from my personal universe *plonk*
Given that Google Groups, which you are using, has no killfile feature yet
(or has it now?), I find that statement rather hilarious.

Rest assured I couldn't care less about the humble opinion about me of an
obviously incompetent anonymous googlodyte formed after the cause of their
misconceptions has been kindly explained to them although quick self-study
by themselves could have revealed it already, and reading some of my newer
proportionate responses to postings of equally clueless script-kiddies.
PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>
Nov 2 '08 #6
BigDave wrote on 02 nov 2008 in comp.lang.javascript:
Ahh I see. I've read some of your previous messages. Consider yourself
erased from my personal universe *plonk*
Who ware youn referring to, usenet is not email?

[please always quote on usenet]

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Nov 2 '08 #7
On Nov 3, 3:19*am, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
BigDave wrote:
Ahh I see. I've read some of your previous messages. Consider yourself
erased from my personal universe *plonk*

Given that Google Groups, which you are using, has no killfile feature yet
(or has it now?), I find that statement rather hilarious.
There are add-ons, such as Google Groups KillFile, that work wtih
Greasemonkey to do just that. Perhaps you should take your own advice
and do some research before posting opinion.

Rest assured I couldn't care less about the humble opinion...
Good to see the feeling is mutual.
--
Rob

Nov 2 '08 #8
On Nov 3, 2:11*am, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
(...)
or be counted as just another googlodyte from this point forward.
(...)
You feel like a member of the upper class just because you use a
newsreader instead of Google Groups.
If that's really making you feel any better, you ought to tell the
doctor... :-)

I, for one, left using newsreaders (MacSoup) more a decade ago, and
don't feel any worse.

--
Jorge.
Nov 3 '08 #9

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

Similar topics

38
by: Grant Edwards | last post by:
In an interview at http://acmqueue.com/modules.php?name=Content&pa=showpage&pid=273 Alan Kay said something I really liked, and I think it applies equally well to Python as well as the languages...
8
by: kalinga1234 | last post by:
there is a problem regarding passing array of characters to another function(without using structures,pointer etc,).can anybody help me to solve the problem.
4
by: JMCN | last post by:
object invalid or no longer set - confusion of the recordset in access 2003. i am currently converting from access 97 to access 2003. majority of the codes converted over perfectly fine, though...
10
Sheepman
by: Sheepman | last post by:
I write most of my programs using only void function. They end up long and bloated because I often write the same code over and over again in each void function. I'm even confused by void functions...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.