I believe I found the problem, but haven't tested the update yet. According to the "Learning jQuery" book, I can't traverse AJAX'd HTML content until I insert it into the current DOM. I'll be testing inserting it into a hidden DIV and then going to town. Hopefully it works. . .
On Sep 8, 8:18 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > 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.