I've already looked through past questions for an answer to this one, but if I missed something and it does exist, please forgive me.
The essence of what I am trying to do is:
Once a checkbox is clicked, a function is executed.
$(".check_group").live('click', function(){
var valueid = $(this).val();
countThem();
if($(this).is(":checked")){
blah blah blah.......
The function goes as such:
function countThem(){
if($('input#currentGroup').val()){
$.ajax({
url: "controlBrief.php?ajah=count_group_establishments",
dataType: "json",
success: function(data){
$("#message_area").html("There are "+data.totalNumber+" establishments already in this group. <BR/>");
$("#message_area").slideDown();
}
});
}
}
The whole thing is successful upto this point, so no problems with the ajax call or with the json encoding from my php page.
The data.totalNumber variable needs to then be returned and saved in a variable to be used either by another function, or within an event. And that is where I am stuck and ask the big HOW? :)
JSON, Ajax and JQuery entered my vocabulary just a month ago, so any direction you can point me to with this one would be great.