Sorry for the late response.
Here is the ajax call :
$.ajax( { url: makeUrl( { argList: [ 'getTree' ] } ),
type: "POST",
data: { treeId: p.data.treeId },
success: getTreeOnSuccess } );
The controller function :
def getTree():
tree = buildTree( { 'nodes': db( db.node.treeId ==
request.vars.treeId ).select( db.node.id, db.node.label, db.node.left,
db.node.right, orderby = db.node.left ) } )
return ''.join( [ '{ "id": "', request.vars.treeId,
'", "tree": ', tree.emit_json(), ' }' ] )
The method called on successfull retrieval :
function getTreeOnSuccess( response ) {
$('#treeInfoPanel').trigger( 'receivedTree', response );
}
Then stuff happens. When I look at the response from firebug, the
string sent back to the client is not all there. When I debug on the
server, it writes the entire string to a file. The call works
intermittently. Any suggestions ?
On Sep 17, 10:47 pm, Adi <[email protected]> wrote:
> It would help to see some code.
>
> On Sep 17, 9:40 pm, "topher.baron" <[email protected]> wrote:
>
> > Hi web2py users,
>
> > I'm encountering a strange issue. About half of every ajax response I
> > get from web2py is not complete. For instance, I'm usually sending a
> > json string from the server to the client. Upon trying to eval the
> > json, I get an unterminated string literal error because the string is
> > not a valid json string. In firebug, and alerting to the screen, the
> > response indeed cuts off somewhere. Has anyone encountered anything
> > like this or have any suggestions for me ?
>
> > I'm happy to post code, more information. Please let me know. Thanks
>
>