Hi Javed, Looks like you are trying to call postActivity(); in text that gets inserted into the innerHTML of an element on the page. Most good, secure web browsers won't execute code that is inserted in this manner. Instead, just do this:
function callback(resp) { document.getElementById('main_content').innerHTML = resp.text; postActivity(); }; Hope this helps, ~Arne On Sep 18, 8:00 am, Javediq143 <[EMAIL PROTECTED]> wrote: > Hi All, > > I've successfully created one application which works fine in all > respect, thanks to the orkut developers guide. But Im facing a serious > problem in creating "Activity" of user action. I hope you all must > have got what I meant to say here. > > Like, if a user views a video on my API and finally ADDs it to his > Favourite, then I want to create an activity of this so all of "his > friend" should come to know about this action. > > I've done this work in my other API where its working fine. I copied > the code which is given in the developers guide in the section where > we learn how to create an activity. The thing is getting done over > here because there is one single XML file which creates the activity > but here in my case I'm passing the URL of an ASP page which resides > on my server which calls a "Javascript" function define in a > Javascript file which creates the Activity. > > Below is the complete code for this. It is just a test so please don't > look for the video thing: > -----------:XML File:------ > <?xml version="1.0" encoding="UTF-8" ?> > <Module> > <ModulePrefs title="Test Activity" > > <Require feature="opensocial-0.7"/> > </ModulePrefs> > <Content type="html"> > <![CDATA[ > <script src="http://go2bollywood.tv/orkut/activity/activity.js"></ > script> > > <div id="main_content"></div> > > <script type="text/javascript"> > gadgets.util.registerOnLoadHandler(init); > </script> > ]]> > </Content> > </Module> > -----------:XML File:------ > > -----------:JAVASCRIPT File:------ > function init() > { > var url = "http://go2bollywood.tv/orkut/activity/index.asp"; > > var params ={}; > params[gadgets.io.RequestParameters.CONTENT_TYPE] = > gadgets.io.ContentType.TEXT; > > gadgets.io.makeRequest(url, callback, params); > > } > > function callback(resp) > { > document.getElementById('main_content').innerHTML = resp.text; > > }; > > function postActivity() { > var title = 'I have created an activity at ' + new > Date().toString(); > var params = {}; > params[opensocial.Activity.Field.TITLE] = title; > var activity = opensocial.newActivity(params); > opensocial.requestCreateActivity(activity, > opensocial.CreateActivityPriority.HIGH, getActivity); > > } > > function getActivity(status) { > if (status.hadError()) > { > alert("Error creating activity."); > } > else > { > alert("Activity successfully created."); > } > }; > -----------:JAVASCRIPT File:------ > > -----------:ASP File:------ > <%@ Language=VBScript %> > <% Option Explicit %> > <script src="http://go2bollywood.tv/orkut/activity/activity.js"></ > script> > <BODY> > <% > response.write "hi<BR>Im here to create activity on Orkut" > %> > <script> > postActivity(); > </script> > </BODY> > -----------:ASP File:------ > > When I run this API the "postActivity();" is not being called but the > text "Hi Im here to.." gets displayed in the targeted DIV. > > I've looked out my best but didnt find a possible solution for this. I > know that there is one but Im not able to find it. Any body could > please help me as how to call this function which will create the > activity or some other way. > > Im in a very urgent need of help because my API has been completed 99% > and the remaining 1% is what I've shared with you all. > > Thanks in advance. > Javed --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "OpenSocial Application Development" group. To post to this group, send email to opensocial-api@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/opensocial-api?hl=en -~----------~----~----~----~------~----~------~--~---