JS
console.log('data={'+fo.slice(0,-1)+'],'+fac.slice(0,-1)+'],'+dir.slice(0,-1
)+'],'+cg_id.slice(0,-1)+'],'+comp_group.slice(0,-1)+'],'+bud.slice(0,-1)+
']}');
I get that json string:
JSON string (from console.log(); in google chrome)
data={"fo":["очная","очная","очная"],"fac":["Мелиорации, водного хозяйства 
и строительства имени А.Н.Костякова","Мелиорации, водного хозяйства и 
строительства имени А.Н.Костякова","Механики и энергетики имени 
В.П.Горячкина"],"dir":["Строительство","Гидромелиорация","Агроинженерия"],
"cg_id":["6","32","29"],"comp_group":["Строительство","Гидромелиорация","Агроинженерия.
 
Тех. системы в агробизнесе; Тех. сервис в АПК; Машины и оборудование для 
хран. и перераб. с.-х. продукции"],"bud":["Да","Да","Да"]}
If I do it:
jQuery.ajax({
                type: "POST",
                url: "{{=URL('useCalc','sess')}}",
                data: 
'data={'+fo.slice(0,-1)+'],'+fac.slice(0,-1)+'],'+dir.slice(0,-1)+'],'+cg_id.slice(0,-1)+'],'+comp_group.slice(0,-1)+'],'+bud.slice(0,-1)+']}',
                cache: false
            });
Controller:
import json
        a = json.loads(request.vars.data)
I have error:
Ticket ID

91.210.96.2.2019-06-20.09-46-31.de5115b4-e6fb-4b0f-92dd-22ce59c495da
<class 'json.decoder.JSONDecodeError'> Unterminated string starting at: 
line 1 column 440 (char 439)Версия
web2py™ Version 2.18.5-stable+timestamp.2019.04.08.04.22.03
Python Python 3.7.3: C:\Python\python.exe (prefix: C:\Python)Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.

Traceback (most recent call last):
  File ".\gluon\restricted.py", line 219, in restricted
    exec(ccode, environment)
  File "C:\inetpub\wwwroot\applications\application\controllers/useCalc.py", 
line 663, in <module>
  File ".\gluon\globals.py", line 421, in <lambda>
    self._caller = lambda f: f()
  File "C:\inetpub\wwwroot\applications\application\controllers/useCalc.py", 
line 642, in sess
    a = json.loads(request.vars.data)
  File "C:\Python\lib\json\__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "C:\Python\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Python\lib\json\decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Unterminated string starting at: line 1 column 
440 (char 439)

Error snapshot [image: help] 
<http://10.250.10.160/admin/ticket/application/91.210.96.2.2019-06-20.09-46-31.de5115b4-e6fb-4b0f-92dd-22ce59c495da#>

JSONDecodeError(Unterminated string starting at: line 1 column 440 (char 
439))

inspect attributes
Frames
   
   - 
   
   *File C:\inetpub\wwwroot\gluon\restricted.py in restricted at line 219* 
   код аргументы переменные
   - 
   
   *File C:\inetpub\wwwroot\applications\application\controllers\useCalc.py 
   in <module> at line 663* код аргументы переменные
   - 
   
   *File C:\inetpub\wwwroot\gluon\globals.py in <lambda> at line 421* код 
   аргументы переменные
   - 
   
   *File C:\inetpub\wwwroot\applications\application\controllers\useCalc.py 
   in sess at line 642* код аргументы переменные
   - 
   
   *File C:\Python\lib\json\__init__.py in loads at line 348* код аргументы 
   переменные
   - 
   
   *File C:\Python\lib\json\decoder.py in decode at line 337* код аргументы 
   переменные
   - 
   
   *File C:\Python\lib\json\decoder.py in raw_decode at line 353* код 
   аргументы переменные
   Function argument list
   
   (self=<json.decoder.JSONDecoder object>, 
   s='{"fo":["очная","очная","очная"],"fac":["Мелиорац...ексов","Агроинженерия. 
   Тех. системы в агробизнесе', idx=0)
   Code listing
   
   347.
   348.
   349.
   350.
   351.
   352.
   353.
   354.
   355.
   356.
   
   
           This can be used to decode a JSON document from a string that may
           have extraneous data at the end.
   
           """
           try:
               obj, end = self.scan_once(s, idx)
           except StopIteration as err:
               raise JSONDecodeError("Expecting value", s, err.value) from None
           return obj, end
   
   Variables
   obj undefined
   end undefined
   self <json.decoder.JSONDecoder object>
   self.scan_once <_json.Scanner object>
   s '{"fo":["очная","очная","очная"],"fac":["Мелиорац...ексов","Агроинженерия. 
   Тех. системы в агробизнесе'
   idx 0
   

-- 
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/d33d1a31-d794-42fa-b6a3-0ae0ac2220dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to