Its error coming only when I start ajax request and return also full page 
with web2py welcome.

> jQuery.ajax({
>                 type: "POST",
>                 url: "getRequest",
>                 data: 'data='+JSON.stringify(data),
>                 cache: false,
>                 success: function(data) {
>                     console.log(data);
>                     $('#results').html(data);
>                 },
>                 error: function(data){
>                     console.log("error");
>                     console.log(data);
>                 }
>             });

controller

> def getRequest():
>     import json
>     a = json.loads(request.vars.data)
>     try:
>         
> db.a_requests.insert(id_item=a['item'].encode('utf-8'),id_type=a['requestType'].encode('utf-8'),item_name=a['itemName'].encode('utf-8'),request=a['requestText'].encode('utf-8'),id_applicant=a['applicant'].encode('utf-8'),email=a['email'].encode('utf-8').strip(),phone=a['phone'].encode('utf-8'))
>         b = True
>     except Exception:
>         b = False
>     if b:
>         return XML('Ваше обращение принято')
>     else:
>         return XML('Во время отправки обращения произошла ошибка') 

[image: 1.png]
 

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to