How to access variable inside jquery promise -
i have variable declared inside function , same function contain code ajax call. want access variable inside .done ,fail & always function of promise. on consoling inside done logging undefined
// rest of code click:function(event){ var gettrtcode = "somevar"; var makecall = $.ajax({ url:"someurl" }) makecall.done(function(response){ console.log(" ******* "+gettrtcode); }) .always(function(){ }) } edit
i dont want make gettrtcode global variable
Comments
Post a Comment