I am using jquery for getting ajax responses from server side functions.
I am in a situation where I need to make two ajax calls one after another and the second one is dependent on the response of the first one.
I have tried to use a code which is similar to this one?
$.ajax({
type: 'GET',
url: 'myURL',
success: function(data1)
{
if(data1==1)
{
$.get('newURL', function(data2)
{
$('#myElement').html(data2);
});
$('#myElement').html(data1);
}
}
});
Is it possible to get two have two ajax calls , one dependent on the other?
if it's possible please explain with demo code . i am new in jquery
Thanks.