Leandro, In your POST function, in your web.py app - you want to import json, and where *returnval* is your current return value, you want to return json.dumps(returnval).
In your success callback function, data.conteudo or data['conteudo'] should work for accessing the value stored under the conteudo key. Hope that helps. -Scott On Thu, Nov 22, 2012 at 10:15 AM, Leandro Severino < [email protected]> wrote: > Hi, > > Sorry by my dummies questions but... > > I created a link in a test page and in the onclick of this link I call > by ajax (jquery) a query in database. > > function get_content(reference_entity){ > ajax_url = "/content/" + reference_entity > jQuery.ajax({ > type: "POST", > url: ajax_url, > success: function(data) { > if (data){ > alert(data); > > obj_return=document.getElementById('conteudo_panel'); > obj_return.innerHTML=data; > } > }, > error: function(e, a) { > obj_return=document.getElementById('conteudo_panel'); > obj_return.innerHTML="Failure! " + e + " " + a; > } > }); > } > > This query return a Storage Object: > <Storage {'descricao_completa': u'F\xeanix Artes Gr\xe1ficas - Convites, > impressos e impress\xe3o digital em Canoas/RS', 'conteudo': > u'<h1>Convites</h1>', 'palavras_chaves': u'portif\xf3lio, produtos', > 'titulo': u'Convites'}> > > Well, I need transform this storage object in a JSON object and put the > content of 'conteudo' key in the innerHTML in a div, how to do this ? > > Thanks, > Leandro. > > -- > You received this message because you are subscribed to the Google Groups > "web.py" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/webpy/-/aIx7I16Y4K8J. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/webpy?hl=en. > -- You received this message because you are subscribed to the Google Groups "web.py" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/webpy?hl=en.
