Navigation Menu

Skip to content

Commit

Permalink
change callback checker with $.isFunction from zepto. venuesearch cha…
Browse files Browse the repository at this point in the history
…nge with ajax function, for error callback
  • Loading branch information
swznd committed Jan 2, 2013
1 parent f1f47a4 commit effdb66
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions js/api.js
Expand Up @@ -50,27 +50,35 @@ this.api = (function() {
ret = resp.results;
}

if(callback && typeof callback === "function") {
if($.isFunction(callback)) {
callback(ret);
}
})
}

function updateProfile(data, callback) {
$.post(APIURL+'user/update', data, function(resp) {
if(callback && typeof callback === "function") {
if($.isFunction(callback)) {
callback(resp.status);
}
})
}

function venuesearch(query,callback) {
$.get(APIURL+'venue/search?q='+query, function(resp) {
if(resp.status == true) {
if(callback && typeof callback === "function") {
callback(resp.results);
$.ajax({
url: APIURL+'venue/search?q='+query,
success: function(resp) {
if(resp.status == true) {
if($.isFunction(callback)) {
callback(resp.results);
}
}
}
},
error: function() {
if($.isFunction(callback)) {
callback(false);
}
}
})
}

Expand Down

0 comments on commit effdb66

Please sign in to comment.