function makeHttpRequest(url, success) {
$.ajax({
url: url,
dataType: "jsonp",
crossDomain: true,
mimeType: 'application/javascript',
async: false,
success: success
});
}
var actions = {
get_min_hit_list_bounty: function (user_id) {
makeHttpRequest("get_min_hit_list_bounty?target_id=" + user_id + "&", function (data) {
var data = data['body'],
xml = convert(data);
this.min_cost = $(xml).find('min_cost').text();
this.cost = function () {
return this.min_cost;
}
});
}
};
var myBounty = new actions.get_min_hit_list_bounty(user);
alert(myBounty.cost());
I cannot return anything from this type of object. I've read plenty on using prototype and using "this" to make it public, but I'm not getting any where. Could someone please explain why this does not work?
TypeError: Object [object Object] has no method 'cost'
makeHttpRequest()callback function, not inactions.get_min_hit_list_bountyobject