You're having a problem with scoping that can be tricky to catch when you're new to asynchronous programming - which all AJAX calls by default are.
When you $.get something, jQuery makes an http call to your server, which at some point responds with an answer. Since your browser doesn't know how long that response will take, it lets that call wait in the background until the server has replied, instead of blocking the rest of the site from functioning. When your browser gets the response, it can perform a function that you gave it ahead of time, with the information it got from the server - a callback.
The code you need looks like this:
function doThingsWithAjaxInfo (stuff) {
// whatever you want your code to do with the information from the server
}
(function() {
$.get( "submissioncount.php", function( data ) {
doThingsWithAjaxInfo(data);
});
})();
// the same thing but a little cleaner, your callback will automatically be called
// on the data that is returned from the server.
(function() {
$.get( "submissioncount.php", doThingsWithAjaxInfo);
})();
Notice how there's no return in the get function. Since the ajax request finishes almost immediately (but does not fire its callback until the server replies), its return would not be useful for you (unless you want to use promises, but I don't recommend getting into them until you're more comfortable with a regular callback driven asynchronous control flow.
Handling scope in javascript is hard, especially when you use asynchronous techniques like ajax, but it makes your code incredibly powerful, and it's well worth the effort to get it right. Good luck!
$connvariable?mysqlifunctions before they are removed. They are already deprecated.mysqlfunctions have been deprecated? Oh man. Anything I should look out for when converting mysql functions to mysqli?