function getguid判断用户登录则返回1,没有登录返回0。如果获得1,则执行另外3个函数,但是实际情况,在返回1的时候,另外3个函数并没有执行,试了很多种办法,就没有找出原因在哪里?求助!!
function checkauthor()
{
var topic_id={topicid};
$.ajax({
url: "url",
cache: false,
data:{
'topic_id':topic_id
},
type : 'POST',
success:function(result)
{
console.log(result);
if(result!=1)
{
$('#author').html(result);
}
}
});
}
function getlikes()
{
var topic_id={topicid};
$.ajax({
url: "url",
data:{
'topic_id':topic_id
},
type : 'POST',
cache: false,
success:function(data)
{
console.log(data);
$('#likes').html(data);
}
});
}
function getguid()
{
$.ajax({
url: "url",
type : 'POST',
success:function(data)
{
if(data==1){
window.g_uid=data;
getlikes();
checkLogin();
checkauthor();
}
}
});
}
getguid();
//登录后评论
function afterlogin()
{
var topic_id={topicid};
$.ajax({
url: "url",
cache: false,
data:{
'topic_id':topic_id
},
type : 'POST',
success:function(result)
{
console.log(result);
if(result!=1)
{
$('#after_login').html(result);
}
}
});
}