I assume that you can do the cross-domain Ajax call because this runs in the browser chrome, is that right? If the Ajax call fails, then of course you won't get very far.
Past that, I would take the code that is failing and break it down to see what data you have at each step: jQuery("textarea:first", ajdata).val() What's in ajdata? Is it what you expect? If it is, then what does jQuery('textarea:first',ajdata) return? A jQuery object, no doubt, but how many elements? What's in that object's .length and [0]? BTW I would probably code it this way instead: jQuery(ajdata).find('textarea:first').val() I think that's a lot more clear than the (selector,context) notation. It should do about the same thing internally, so if the original code didn't work, I wouldn't expect this to work either - but you could try it and see. If it didn't work, my debugging breakdown would be: typeof ajdata ajdata jQuery(ajdata) jQuery(ajdata).length jQuery(ajdata)[0] jQuery(ajdata).find('textarea:first') jQuery(ajdata).find('textarea:first').length jQuery(ajdata).find('textarea:first')[0] -Mike > From: [EMAIL PROTECTED] > > Sure thing. > > Here is the whole ubiquity (http://labs.mozilla.com/2008/08/ > introducing-ubiquity/) command in its current form. The > relevant section is at the end. > > CmdUtils.CreateCommand({ > name: "tag-cloud", > takes: {body_of_text: noun_arb_text}, > > description: "Replaces selected text with a frequency-based > tag cloud.", > > preview: "Creates a tag cloud out of selected text.", > execute: function(statusText) { > if(statusText.text.length < 100) { > displayMessage("You probably want to selecet more text > to make a decent cloud"); > return; > }; > > var updateUrl = "http://tagcrowd.com/index.pl"; > var updateParams = { > name: "tagcrowd", > text: statusText.text, > doStemming: "yes" > }; > > jQuery.post(updateUrl, updateParams, function(ajdata) { > displayMessage(jQuery("textarea:first", ajdata).val()); > }, > "html"); > } > }); > > The page I'm POST-ing to, and getting the contents of is: > http://tagcrowd.com/index.pl > Basically I just want to use a selector on that returned > page, but passing it in as the context doesn't seem to work . > . .or I'm doing it wrong. > > Thanks. :) > > On Sep 7, 6:13 pm, "Michael Geary" <[EMAIL PROTECTED]> wrote: > > Can you post a link to a test page that illustrates what > you're trying > > to do and what isn't working? It's pretty hard to tell what > might be > > wrong without seeing things like the HTML that the $.post() returns. > > > > -Mike > > > > > From: [EMAIL PROTECTED] > > > > > I'm having trouble using a subsequent selector on an HTML page > > > returned from $.post, while trying to write a Ubiquity command. > > > > > If I log or display ajdata, as returned from the $.post, > it contains > > > the HTML page, as expected, and shows up as a jQuery object in > > > Firebug. > > > > > What I want to do is use a jQuery selector to extract a named > > > textarea within the returned HTML, so I plug in the object as the > > > context and provide a selector, as below: > > > > > jQuery.post(updateUrl, updateParams, function(ajdata) { > > > > > CmdUtils.log(jQuery("textarea[name=cloudsource]", > > > ajdata).val()) }, "html"); > > > > > Firebug just gives me "unknown" for the response. If I > remove the > > > slector, and just pass "ajdata" to CmdUtils.log, then I > see a jQuery > > > object in Firebug. > > > > > At first I thought my selector was in error, but even > changing it to > > > obvious things like "body", "div", etc produced the same > "undefined" > > > in Firebug, so I guess I'm misunderstanding how context works for > > > jQuery. Any insight would be appreciated. >