开发者

how to read information of an ajax-dialogbox

I want to develop an firefox-extension using javascript&jQuery which extrats the facebook-privacy settings of a user. At the "pri开发者_如何学Cvacy settings" menue you can click at "Edit settings" and i want to read the settings the user entered.

Here a picture:

how to read information of an ajax-dialogbox

I had 3 ideas for a solution:

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?

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.

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);
    }
});

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.

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?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜