Unfortunately, you generally can't use jQuery to parse an entire page.
You'll have to use Utils.parseRemoteDocument() like so:

Utils.parseRemoteDocument(
  PRIBERAMUBIQUITY.priberamUrl + word,
  null,
  function(document) {
    var wordDefinition = jQuery('#lblDlpoDefinicao', document).text();
    pblock.innerHTML = "Definition: " + wordDefinition;
  },
  function() {
    pblock.innerHTML = "Error";
  }
);


Hope that helps.

- Blair



On Sun, Oct 26, 2008 at 4:00 AM, Edgar Gonçalves
<[EMAIL PROTECTED]> wrote:
>
> Hi!
>
> I'm trying to add a preview message in a dictionary command, by
> fetching a web site and finding a specific id in the DOM tree. This is
> the command I'm using:
>
> getDefinitionPage: function (word, pblock) {
>  jQuery.get(PRIBERAMUBIQUITY.priberamUrl + word,
>             null,
>             function (data) {
>               var r = jQuery('lblDlpoDefinicao', data).text();
>               CmdUtils.log(data);
>               CmdUtils.log(r);
>               PRIBERAMUBIQUITY.wordDefinition = r;
>             },
>             "html"
>            );
> },
>
>
>
> My trouble is that, despite having a span with the id
> "lblDlpoDefinicao", the variable 'r' contains an empty string. (I
> tried with .html(), but the result is a null object. I've also tried
> looking for "#lblDlpoDefinicao", with no difference.). What am I doing
> wrong to parse the 'data' variable with jQuery? Using
> jQuery(data).find(id-name) didn't work either. Oh, I'm using the
> Ubiquity v0.1.2.
>
> Thanks in advance for any hint on what I'm doing wrong.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ubiquity-firefox" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/ubiquity-firefox?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to