[jQuery] how to add callback in the $.ajax ?
Hi,
can i have callback function on the $.ajax ?
I don't want to use async since it will block the browser ... so can i
use callback instead ?
I would like to have function that return json like this
function getGoodsDetail(id,member){
var result ;
$.ajax({
type: "POST",
url : "/goods/detail/",
data : "id="+id,
dataType: "json",
async:false,
success : function(data){
var price = 0 ;
if(member == 'Y'){
price = data.priceMember ;
}else{
price = data.priceNonMember;
}
// I want to return data to user
result = data
}
});
return result; // --> always undefined
}
so when I call getGoodsDetail(id, membership) it will return json
value ...