I have JS object which was coverted to JSON string.
JS:
data = {
email:$('#email').val(),
phone:$('#phone').val(),
docs:$('#studDoc option:selected').text(),
quantity:$('#quantity').val(),
organization:$('#organization').val(),
dateS:$('#dateStart').val(),
dateE:$('#dateEnd').val(),
mailing:$('#mailing').prop('checked'),
socialLink:$('#socialLink').val()
};
jQuery.ajax({
type: "POST",
url: "stud_request",
data: 'data='+JSON.stringify(data),
cache: false,
success: function(data) {
deleteOrders();
$('#results').html(data);
$('.cssload-loader').hide();},
error: function(data){
console.log("error");
console.log(data);
$('.cssload-loader').hide();
}
Then I get it in controller.
Python:
def stud_request():
import json
a = json.loads(request.vars.data)
It's what I can see in console JS
JSON string
{"email":"","phone":"8-999-99-99-999; 8-999-99-99-999","docs":"Creating
email","quantity":"1","organization":"","dateS":"","dateE":"","mailing":false,"socialLink":""}
In web2py ticket I see that string be interrupted
<type 'exceptions.ValueError'>(Unterminated string starting at: line 1
column 21 (char 20))
Function argument list
(self=<json.decoder.JSONDecoder object>,
s='{"email":"","phone":"8-999-99-99-999', idx=0)
My questin is why *;* symbol causes error (as I know it's not special JSON
symbol)?
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.