如何读取ajax对话框的信息 [英] how to read information of an ajax-dialogbox

查看:79
本文介绍了如何读取ajax对话框的信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用javascript&jQuery开发firefox扩展名,以扩展用户的facebook隐私设置. 在隐私设置"菜单上,您可以单击编辑设置",我想读取用户输入的设置.

I want to develop an firefox-extension using javascript&jQuery which extrats the facebook-privacy settings of a user. At the "privacy settings" menue you can click at "Edit settings" and i want to read the settings the user entered.

这里有一张图片:

我有3个解决方案:

第一个想法:我在脚本中寻找一种方法来伪造"对链接的单击.但是我还没有找到一个函数...我尝试了.click()和.trigger('click'),但这不起作用...对此有任何想法吗?

First idea: I looked for a way in my script to "fake" the clicking on the link. But I haven't found a function... I tried .click() and .trigger('click') but that doesn't work... any idea for this?

第二个想法:如果没有办法伪造"该点击,我试图用window.location.href ="

Second idea: If there is no way to "fake" that click, i tried to simply open that link with window.location.href = "http://www.facebook.com/ajax/settings/privacy/connect.php"; but that just lead me to the facebook-startpage.

最后一个想法:用ajax发出请求.我使用FireBug来获取参数.在我的内容脚本中,我使用了jQuery:

last idea: make a request with ajax. I used FireBug to get to the parameter. In my content-script I used jQuery:

var data = '__a=1&__d=1&__user=100002895945078';

$.ajax({
    type:"GET",
    url:"http://www.facebook.com/ajax/settings/privacy/connect.php",
    data: data,
    success: function(response) {
        alert(response);
    },
    error: function(xhr) {
        alert('Error!  Status = ' + xhr.status);
    }
});

我使用了FireBug,发现该请求与单击编辑设置"链接一样.即使响应是相同的(您可以在这里看到它: http://pastie.org/private/gk7fnfkftoreaklkqd8xlmqhw) 我需要的信息包含在此响应中,但我不知道该如何获取.

I used FireBug and found out that the Request is the same as if i click on the "Edit settings"-link. Even the Response is the same (you can see it here: http://pastie.org/private/gk7fnfkretolkqd8xlmqhw) The information I need are included at this Response, but I don't know how to get to it.

我从错误警报:"Error! Status = 200"中得到,但通常200可以!! 对话框未弹出,并且未添加DOM节点. 我必须自己做吗?

I get from the Error-alert: "Error! Status = 200", but normally 200 is ok!? The Dialog isn't popping up and the DOM node isn't added. Do I have to do this myself?

推荐答案

我明白了.问题是我忘记将DataType设置为文本.

I got it. The problem was that I forget to set the DataType to text.

这篇关于如何读取ajax对话框的信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆