Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #31360

What's supposed to be the correct syntax to call function that has jQuery ajax within?

X-Received by 10.13.219.210 with SMTP id d201mr2119121ywe.53.1473796816846; Tue, 13 Sep 2016 13:00:16 -0700 (PDT)
X-Received by 10.157.57.194 with SMTP id y60mr1393136otb.20.1473796816801; Tue, 13 Sep 2016 13:00:16 -0700 (PDT)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!m9no2995660qte.0!news-out.google.com!w143ni178itb.0!nntp.google.com!u18no975675ita.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.javascript
Date Tue, 13 Sep 2016 13:00:16 -0700 (PDT)
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=50.89.247.156; posting-account=OqV0cQoAAADtRo2i3qWfieIZ6a02VVn5
NNTP-Posting-Host 50.89.247.156
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <61ffa1ca-36ca-4081-a1f8-b7e51966bb50@googlegroups.com> (permalink)
Subject What's supposed to be the correct syntax to call function that has jQuery ajax within?
From justaguy <lichunshen84@gmail.com>
Injection-Date Tue, 13 Sep 2016 20:00:16 +0000
Content-Type text/plain; charset=UTF-8
Xref csiph.com comp.lang.javascript:31360

Show key headers only | View raw


Hi,

I attempted to call a function by assign it to a variable's value but it complained about "undefined", what is the correct way?  Thanks.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script>

// ajax call for a server side script with State and County parameters
function ckCounty(st,cunty) {
	$.ajax({
		url: 'whateverScript.file?state='+st+'&county='+cunty,
		success: function(rtn) {
			rtn = eval(rtn);
			if (rtn > 0) 
			{ 
				return 'green';		
			}	
		 // setTimeout(ckCounty, 2000);    
		}
	});
}


var	Color = 'grey';
Color = ckCounty('ga','TAYLOR');

console.log(Color);

</script>

Back to comp.lang.javascript | Previous | NextNext in thread | Find similar | Unroll thread


Thread

What's supposed to be the correct syntax to call function that has jQuery ajax within? justaguy <lichunshen84@gmail.com> - 2016-09-13 13:00 -0700
  Re: What's supposed to be the correct syntax to call function that has jQuery ajax within? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-14 00:25 +0100
    Re: What's supposed to be the correct syntax to call function that has jQuery ajax within? justaguy <lichunshen84@gmail.com> - 2016-09-16 18:13 -0700
  Re: What's supposed to be the correct syntax to call function that has jQuery ajax within? JJ <jj4public@vfemail.net> - 2016-09-14 06:52 +0700
    Re: What's supposed to be the correct syntax to call function that has jQuery ajax within? justaguy <lichunshen84@gmail.com> - 2016-09-16 18:12 -0700

csiph-web