Hi all,
I'm making a script which has one ajax call inside an each function. The problem is that on the success callback from ajax call, I want to use the object that we are using at each function.
EDIT: Here is some of my code:
configs={
general:{
max_ads:6},
logs:{
selector:"div#MicrodualGetAd-debug"},
connection:{
type:"POST",
url:"http://www.microdual.com/api/microdualgetad",
cache:false,
timeout:20000,
dataType:"json",
data:{
adget_id:null,
adget_session:null,
client_action:null},
error:function(r,s,e){
MicrodualGetAdLog("Ajax-Error: "+s+"\n");
}
}
};
$("div.MicrodualGetAd").each(function(){
configs.connection.data.adget_id = $(this).attr("rel");
configs.connection.data.client_action = "view";
configs.connection.data.success = function(d,s,r){
$(this).hide();
alert("'OK'");
if(d.hackattemp.status){
MicrodualGetAdLog("MicrodualGetAd-Error: "+d.hackattemp.msg+"\n");
$(this).append(d.hackattemp.msg);
}
}
$.ajax(configs.connection);
});