After last upgrade i've this problem with response.json
-----Controller cut -------
if form.process().accepted:
return response.json({'formkey':form.formkey,'html'
:XML(html_from_helpers)})
-----cut -------
The json generated by controller fails in this js because don't escape
double quotes in html_from_helpers string. Is it a bug? Before last update
it worked fine ....
$('#form').submit(function(e){
e.preventDefault();
$.ajax({
type: "POST",
url: "/my/url",
data: $('#form').serialize(), // serializes the form's elements.
success: function(json)
{
risposta=JSON.parse(json);; // show response from the php script.
$('#form:input[name="_formkey"]').val(risposta.formkey);
$('#myUL').html(risposta.html).listview('refresh');
$(".risposta_flash").remove();$('<div class="ui-body
ui-body-b risposta_flash" style="margin:20px;">Stato di cura
inserito</div>').prependTo("#content_principale").hide().slideDown();
}
});
return false;
});
Thx
--
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.