By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,796 Members | 1,240 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,796 IT Pros & Developers. It's quick & easy.

Function( confusion

P: n/a
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
Share this Question
Share on Google+
8 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
Ahh I see. I've read some of your previous messages. Consider yourself
erased from my personal universe *plonk*
Nov 2 '08 #5

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.