Ok Sachin,with the help of Robson Dantas,I made some changes on my code...the activity is posted,the message is shown,but the variable isn't readed...for example it prints something like:"User give some undefinied data"...the undefenied data is the variable...I will post the code,maybe you can help me with this: <Content type="html" view="profile"> <![CDATA[ <b id = "ativ"</b> ]]> </Content>
<Content type="html" view="canvas"> <![CDATA[ <html> <head> <script type="text/javascript"> var globalView = gadgets.views.getCurrentView().getName(); function init() { loadFriends(); requisitaPagina("path "); } function requisitaPagina(page) { var params={} params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.TEXT; gadgets.io.makeRequest(page, onPaginaCallback,params); } // callback retornado a partir da funcao acima function onPaginaCallback(ret) { var x = document.getElementById("teste"); x.innerHTML = ret.text; } function loadFriends() { var req = opensocial.newDataRequest(); req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.VIEWER), 'viewer'); var viewerFriends = opensocial.newIdSpec({ "userId" : "VIEWER", "groupId" : "FRIENDS" }); var opt_params = {}; opt_params[opensocial.DataRequest.PeopleRequestFields.MAX] = 100; req.add(req.newFetchPeopleRequest(viewerFriends, opt_params), 'viewerFriends'); } function enviaPost() { var destino = "/call_recharge"; var telefone = document.getElementById("id_phone1").value; var username = document.getElementById("id_username").value; var password = document.getElementById("id_password").value; var carrier = document.getElementById("id_mobile_carrier"); carrier = carrier.options[carrier.selectedIndex].value; // campos de post que serão enviados var postdata = {phone1: telefone, phone2: telefone, mobile_carrier: carrier, username:username, password:password}; postdata = gadgets.io.encodeValues(postdata); alert('postdata =' + postdata); var params = {}; params[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.POST; params[gadgets.io.RequestParameters.POST_DATA]= postdata; gadgets.io.makeRequest(destino,postActivity,params); postActivity(destino,postdata); } function postActivity(destino,postdata){ var title = 'cel do usuário:' + postdata.phone1; var params = {}; params[opensocial.Activity.Field.TITLE] = title; var activity = opensocial.newActivity(params); opensocial.requestCreateActivity(activity, opensocial.CreateActivityPriority.HIGH,callbackAtividade); } function callbackAtividade(ret) { var z = document.getElementById("ativ"); z.innerHTML = ret.text; } gadgets.util.registerOnLoadHandler(init); </script> </head> <body> <div id="post"><input type="submit" onclick="enviaPost()" value="ENVIAR POST"></div> <div id="teste">conteudo</div> </body> </html> ]]> </Content> </Module> 2010/5/11 André Lima <azdr3mi...@gmail.com> > Hello everybody...I am trying to make an activity on my aplication,but > it don't work...i get some values of a html page that is outside of > xml...there is no return,no message of update is show...i don't what > is wrong,i will post the code here...maybe you can help me: > <?xml version="1.0" encoding="UTF-8" ?> > <Module> > <ModulePrefs title="..." > directory_title="..." > description="...." > screenshot="..." > title_url="http://www.counttonine.com" > author="Ted Mosby" > author_email="..." > author_link="http://www.counttonine.com/aboutUs.htm" > author_location="..." > author_affiliation="Count to Nine" > height="370" > scrolling="false" > author_aboutme="..." > author_photo="..." > author_quote="..." > thumbnail="..."> > <Preload href = "http://netmony.marestelecom.net/gadget/ > recharge/"/> > <Require feature = "opensocial-0.8"/> > </ModulePrefs> > <Content type="url" href="http://netmony.marestelecom.net/gadget/ > recharge/ <http://netmony.marestelecom.net/gadget/%0Arecharge/>"> > > > > > <![CDATA[ > <script type = "text/javascript"> > var globalFriends = {}; > function callbackCustom(responseItem){ > if(responseItem.hadError()){ > if responseItem.getErrorCode(){ == > opensocial.ResponseItem.ERROR.NOT_IMPLEMENTED){ > alert("not implemented"); > }else{ > alert("success!" + rensponseItem.getErrorCode()); > } > var returnData = rensponseItem.getData(); > > } > function postActivity(text){ > var url = 'http://netmony.marestelecom.net/gadget/recharge/'; > opt_params = {}; > opt_params[gadgets.io.RequestParameters.CONTENT_TYPE] = > gadgets.io.ContentType.TEXT; > gadgets.io.makeRequest(url,opt_params,callback); > var price = document.getElementById('id_price'); > url = gadgets.io.encodeValues(price); > var text = 'Compra de recarga.' + > globalFriends.getById(viewerFriends).getDisplayName() 'comprou' + > price.value 'reais de recarga de operadora Y.'; > var params = {}; > params[opensocial.Activity.Field.TITLE] = text; > var activity = opensocial.newActivity(params); > > > > opensocial.requestCreateActivity(opensocial,opensocial.CreateActivityPriority.HIGH,callbackCustom); > } > function loadFriends() { > var req = opensocial.newDataRequest(); > req.add(req.newFetchPersonRequest("VIEWER"), 'viewer'); > > var viewerFriends = opensocial.newIdSpec({ "userId" : "VIEWER", > "groupId" : "FRIENDS" }); > var opt_params = {}; > > opt_params[opensocial.DataRequest.PeopleRequestFields.MAX] = 100; > req.add(req.newFetchPeopleRequest(viewerFriends, opt_params), > 'viewerFriends'); > var viewer = opensocial.newIdSpec({ "userId" : "VIEWER" }); > req.send(postActivity); > } > function init(){ > loadFriends(); > } > gadgets.util.registerOnLoadHandler(init); > </script> > ]]> > </Content> > </Module> > > -- > You received this message because you are subscribed to the Google Groups > "Orkut Developer Forum" group. > To post to this group, send email to opensocial-or...@googlegroups.com. > To unsubscribe from this group, send email to > opensocial-orkut+unsubscr...@googlegroups.com<opensocial-orkut%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/opensocial-orkut?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Orkut Developer Forum" group. To post to this group, send email to opensocial-or...@googlegroups.com. To unsubscribe from this group, send email to opensocial-orkut+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/opensocial-orkut?hl=en.