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?

Newsgroups comp.lang.javascript
Date 2016-09-13 13:00 -0700
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>

Show all headers | 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