function Ajax_Async(restUrl, params, restType, cacheFlag, callback) {
$.ajax({
type: restType,
async: true,
//To make a ASYNC call only... callback will be called after success
url: RootUrl_ + restUrl,
data: params,
cache: cacheFlag,
//To clear Cache since the datatype can be Json.For Json datatype by defualt cache is true
success: function (result) {
$('body').data('result', result);
//which is used in callback...
new callback;
},
error: function (error) {
alert(error);
}
});
}
Test method:
=========
function MyTestMethod()
{
test('MyOriginalMethod', function(){
MyOriginalMethod();
stop();
//start is in callback of async call
});
test('Test the Values', function(){
ok($('#master_div').children().length > 0, 'Values present in Master div');
ok($('#user_div').children().length > 0, 'Values present in User div');
});
}
When both are tested independently they get passed, but when the function as a whole including both is tested it gets failed. It would be great somebody can help me on this..
Thanks in advance..
Ramesh