简体   繁体   English

Facebook.streamPublish()完成后如何重定向?

[英]How can I redirect after Facebook.streamPublish() has completed?

I have an application which will post a message on a friends wall using the Facebook.streamPublish() method, and this works perfectly. 我有一个应用程序,该应用程序将使用Facebook.streamPublish()方法在朋友墙上发布一条消息,并且此方法非常有效。 However, I want to also be able to save details about this post in my database. 但是,我还希望能够将有关此帖子的详细信息保存在我的数据库中。

All the information that needs to be stored is placed into hidden form fields and are all in place once the message has been sent, so I figure that all I need to do is redirect to a php file which will take this information, save it into the database and then redirect back to the main page. 所有需要存储的信息都被放置在隐藏的表单字段中,并且在消息发送后都就位了,因此我认为我所要做的就是重定向到一个php文件,该文件将接收此信息并将其保存到数据库,然后重定向回主页。

The streamPublish call is: streamPublish调用为:

Facebook.streamPublish(\'\', attachment, null, params.ids[curFriend]);

which I can follow with form.submit() which will cause the redirect to happen, but this submit() function gets called instantly, and doesn't wait for the streamPublish() popup to load, be used, and the action to be completed. 我可以使用form.submit()跟随它,这将导致重定向发生,但是此commit()函数被立即调用,并且不等待streamPublish()弹出窗口加载,使用和执行操作完成。 How can I make my form.submit() not be called until the user has hit the 'publish' button in the popup which occurs? 在用户点击弹出式窗口中的“发布”按钮之前,如何才能不调用form.submit()?

I've not used the streampublish() function or the FB API, but I can guarantee that this is because the streampublish is handled by an ajax call, which is thus handled separately from the normal JS code chronology. 我没有使用过streampublish()函数或FB API,但是我可以保证这是因为流发布是由ajax调用处理的,因此与正常的JS代码时间顺序分开处理。 So any code that should be executed when the ajax has reached a specific state needs to be added to the ajax statehandler, which the FB API may or may not give you access to. 因此,需要在ajax达到特定状态时执行的任何代码都需要添加到ajax状态处理程序中,FB API可能会也可能不会允许您访问。

StreamPublish also takes an optional callback function - http://developers.facebook.com/docs/?u=facebook.jslib.FB.Connect.streamPublish . StreamPublish也有一个可选的回调函数- http://developers.facebook.com/docs/?u=facebook.jslib.FB.Connect.streamPublish Try setting your submit() function as the callback and it should get called once the user cancels the dialog or publishes it 尝试将您的commit()函数设置为回调函数,一旦用户取消对话框或发布对话框,该函数便会被调用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 通过add.php(Facebook)添加页面后,如何将用户重定向到自定义网址 - how can i redirect a user to custom url after adding page through add.php (Facebook) 如何在另一个完成后发出 http 客户端请求? - How can I make a http client request after another is completed? 用Facebook登录后如何重定向 - how to redirect after login with facebook 如何检查Facebook图形API请求是否已完成 - How to check if a Facebook graph api request has completed 循环完成后成功重定向 - Redirect successfully after loop is completed 我该如何解决Facebook重定向uri错误? - How Can I solve the facebook redirect uri error? 表单完成后PHP重定向 - PHP redirect after form completed 如果我在 sh 文件中有 2 个 php 脚本,我可以确定第二个脚本只会在第一个脚本完成后开始运行吗? - If I have 2 php scripts in an sh file can I be sure that the second script will only start running after the first script has completed? 如何判断我的PHP S3类putObjectFile()过程是否已完成? - How can I tell if my PHP S3 class putObjectFile() process has completed? 如何确定使用S3Client :: upload()上传的文件已成功完成? - How can I be sure that an upload with S3Client::upload() has completed successfully?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM