1function checkUserIdExists(userid, callback) {
2 return $.ajax({
3 url: 'theurl',
4 type: 'GET',
5 cache: false,
6 data: {
7 userid: userid
8 }
9 })
10 .done(callback)
11 .fail(function(jqXHR, textStatus, errorThrown) {
12 // Handle error
13 });
14}
15
16checkUserIdExists(2, function(data) {
17 console.log(data); // Do what you want with the data returned
18});