var strTest = '';
$.post(
'test.php',
{ post_test : 1 },
function(data) {
strTest = data.split('a');
$.post(
'test_2.php',
{ post_test_2 : 2 },
function(sData) {
alert(strTest);
}
);
}
);
strTest – is empty! Why?
Your code seems to be working. I have reproduced your case in a jsfiddle and as you can see from the resulting alert,
strTestcontains data. The problem probably stems from the fact thattest.phpreturns nothing.