Passing parameters in ajax function call
Hi,
I'm trying to pass parameters using the
jquery's ajax function, but I end up with a
"function undefined" error message when I try.
I had trouble finding simple examples of ajax
passing parameters with jquery.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
function theCall(State, County) {
$.ajax({
type: 'POST',
url: 'someurl.php',
data: 'State=' + State + '&County=' + County,
dataType: 'html',
success: function(msg) {
alert( "Data retrieved: " + msg );
}
});
}
});
</script>
</head>
<body>
<a href="#" onclick="theCall('California','Monterey');">some link</a>
<div id="container">
Eventual placement of data.
</div>
</body>
</html>