c# - Jquery $.post in while loop -
c# - Jquery $.post in while loop -
this code :
@ { httpcookie cookieportrait = request.cookies["photoportraitcookie"]; int pportraitkeyscount = (cookieportrait.values.keys.count); } <script> $(function () { var specarr = new array(); @ { int n = 0; while (n < pportraitkeyscount) { string str = cookieportrait.values.getkey(n).tostring(); @: var datass = {}@: datass = {@: decode: '@str', @: '__requestverificationtoken': $('[name="__requestverificationtoken"]').val()@: }@: $.post('/photo/decode', datass, function (datar) {@: specarr.push(datar);@: });@: specarr.push('@httputility.urldecode(generalcookie.values.getvalues(n).getvalue(0).tostring())') @: n++; } }) </script>
its tries take cookie , fill array cookie values , because uses swedish languages , encoded values , must post server decode , razor decode not working in html.
my problem post not working correctly , instead of doing iteration in while process , iterates after while iteration while count separately.
c# javascript jquery ajax razor
Comments
Post a Comment