How to update javascript variable after ajax call back
var x =1;
$(document).on('click','.classname',function(){
console.log(x);
});
$.ajax({
type:'post',
url:tmplUri+'/ajax/test.php',
cache:false,
async:false,
data:{journey:'yes'},
success: function(data)
{
x = data;
}
});
after ajax call i need to update the variable on that page
Please give any suggestion for this issue