I'll try to simplify it, hoping that I'll figure it out, but it's really very puzzling:
this works perfect: var encodedDescription = $("#CurrentCartDescription").text(); $("#CurrentCartDescription").html(atob(encodedDescription)); it decodes it back just exactly from what it was encoded. However, the following is messed up: $(".EncodedDescriptionField").each( function(index, element ){ var hereWeAre = $(this).text(); var decodedString = atob(hereWeAre); console.error(hereWeAre); console.error(decodedString); }); throws an exception, even for the same very value! Will simplify it all now, let's see what comes out... On Friday, May 17, 2019 at 12:20:37 PM UTC-4, Vlad wrote: > > It works almost, but not 100% :) > > with encodeURIComponent : > > abc def (test) > comes back as > abc_def__test_ > > a;slkdjf;l -239i4-29i23la'skfj(()))9012? <>,. = > comes back as > a_slkdjf_l_-239i4-29i23la_skfj_____9012______.__= > > This wouldn't help me, because I want it to be exactly whatever they enter > - > > In contrast, atob and btoa work just perfect, except that in one > particular situation is gets messed up by that exception... > > On Friday, May 17, 2019 at 10:17:50 AM UTC-4, Anthony wrote: >> >> On Thursday, May 16, 2019 at 3:43:58 PM UTC-4, Vlad wrote: >>> >>> I have the following javascript in the view: >>> >>> var id = $('#CurrentCartId').text(); >>> var description = $(this).text(); >>> var url='{{=URL('cart','description')}}'; >>> url += '/' + id + '/'; >>> url += description; >>> ajax(url,[],':eval'); >>> >> >> How about putting the variables in the query string: >> >> const id = $('#CurrentCartId').text(); >> const description = $(this).text(); >> const url='{{=URL('cart','description')}}'; >> ajax( >> `${url}?id=${encodeURIComponent(id)}&description=${encodeURIComponent(description)}` >> , [], ':eval'); >> >> Then in the controller, access request.vars.id and >> request.vars.description. >> >> Anthony >> > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/4fc90afb-1e30-439d-b5ba-730df5bb1a34%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.