jquery - How can I redefine a variable based on a functions result? (javascript) -
i have following:
$('#country1').change(function() { var hrc = "yes"; if (classname == "hr") { var hrc = "yes"; return true; } else { var hrc = "no"; return false; }
then pulling json sp list like:
$('.submitdataaccounts').on('click', function() { var data = { __metadata: { 'type': 'sp.data.changeofaddresslistlistitem' }, "high_risk_country": hrc, };
this part works correctly else in form posts list
if leave static variable @ top of page passes correctly not work if it's based on fuction.
thanks,
declare variable outside functions, global variable, , can acces everywhere in code. if give global variable value, redefined , gets value until value change.
Comments
Post a Comment