I am using jQuery and I have to do it like this:
data = $.getJSON('/accounts/ajax/user_details/', {'user_id' : "$user_id"})
.fail();
update_user_details(data);
... since if I set the callback function .done() as suggested in the official documentation, the variable 'data' seems not to be defined:
$.getJSON('/accounts/ajax/user_details/', {'user_id' : "$user_id"})
.done( update_user_details(data) ),
.fail();
Any ideas?