"Mentorslist" varibale aynı işlevde nasıl erişilir. "mentorslist" ajax çağrısının başarısıdır. Ancak mentor() işlevi içinde erişemiyorum.Ajax başarı işlevi özel işlev içinde erişemiyor
function mentors(){
var mentorslist = '';
$.ajax({
type: "POST",
url: <?php echo '"'.base_url().'index.php/MentorList/'.'"'; ?>,
data: { pagelimit: 1,json: "true" },
success: function(msg)
{
var obj = jQuery.parseJSON(msg);
var $mentor_list ="";
var mlist = '';
jQuery.each(obj.resset, function(i, val){
mlist = mlist+'<option value="'+val.mentor_Id+'">'+val.Name+'</option>';
$("#mlist").get(0).options[$("#mlist").get(0).options.length] = new Option(val.Name,val.mentor_Id);
});
mentorslist = mlist; //Able to access here
}
});
return mentorslist; // gives undefine error
}
mentorslist değişken ajax başarı içine ayarı ve özel görev ekseninde dönmeye çalışıyor Buraya bakın ama bana tanımsız döndürür.
mentorslist bitmemiş kullanarak undefined – Ni3
çalıştı Bu sevgili ... Sen Rock's .. Çok teşekkür ederim. – Ni3