callback function > return string

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
pedroz
Forum Commoner
Posts: 99
Joined: Thu Nov 03, 2005 6:21 am

callback function > return string

Post by pedroz »

I would like to get the word 'test' from the callback function psCallback below.

alert(opt); is now displaying the word 'test'

What am I doing wrong?

Code: Select all

function psCallback() {
	var content = 'test';
	
	return content;
}
	
	
jQuery(document).ready(function () {
	
	var opt = {callback: psCallback};
		
	alert(opt);	
		
	return false;

});
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: callback function > return string

Post by requinix »

Code: Select all

alert(opt.callback());
Post Reply