created two functions i want to call the get_name_from_id when my first ajax function get successful but it is not working when i add alert in get_name_from_id function after jsonstring like alert("xyz") it shows but ajax part not exectue
function get_name_from_id(){
var team_name = ("sahil","krishna");
var jsonString = JSON.stringify(team_name);
$.ajax({
dataType:"json",
type:"POST",
url:"fetchidwithname.php",
data: {team_name : jsonString},
cache: false,
success:function(a)
{
alert(a);
}
});
}
$("#matchbet").click(function(){
var matchlist = $("#match_list option:selected").val();
var jsonString = JSON.stringify(matchlist);
$.ajax({
dataType:"json",
type:"POST",
url:"selectedmatch.php",
data: {matchlist : jsonString},
cache: false,
success:function(currentmatch)
{
var current_bettable = team1 + "_vs_"+ team2 + matchdate;
var bet_team= '<select id="betting_team"><option value='+ team1 +'>'+ currentmatch.team1 + '</option><option value='+ team2 +'>'+ currentmatch.team2 + '</option></select>';
$("#teamholder").html(bet_team);
$("#current_match_table").val(current_bettable);
get_name_from_id();
}
});
});