When viewing the block on a node, the default term shows results properly. Changing the term in the dropdown removes the results, collapses the block, and disables the dropdown with the new value set. But the new term selection never re-populates the block with new results. It stays collapsed. Tried in Firefox and IE. Is this a bug or am I doing something wrong?

Comments

jgumpert’s picture

I did a bit of old-school javascript debugging in combination with research on the $.ajax function and I think I found the root cause - the "url" option in the $.ajax function was failing because it is a relative url like "/taxonomy_quick_find/0/125". When I hardcoded the base url of my test system into the "url" it started working properly.

The other thing that helped me discover it was by adding an "error" option to the $.ajax function with some alerts to see that the JSON callback was indeed failing until I changed the url. Not sure what this means - is this a bug?

jgumpert’s picture

One more finding - the standard "url" value works ok on another system where the base_url of drupal is the hostname without any extra directories after it. But I had to hardcode the full server name on any systems that use something like http://example.com/cms rather than just http://example.com/.

doc2@drupalfr.org’s picture

kansaj’s picture

Hi

Can you provide some more from the example that you have done ?
thank you

jgumpert’s picture

In taxonomy_quick_find.js, I changed this:

        //Do an JSON callback using the AJAX handler
        $.ajax({
          type: "GET",
          url: "/taxonomy_quick_find/" + delta + "/" + select.value,
          dataType: "json",

to the following with a hardcoded URL:

        //Do an JSON callback using the AJAX handler
        $.ajax({
          type: "GET",
          url: "http://example.com/cms-app/taxonomy_quick_find/" + delta + "/" + select.value,
          dataType: "json",

Like I said, this change is not needed if your drupal system uses a url without any additional directory elements like "cms-app". Hope this helps...

nicholasthompson’s picture

Title: Changing taxonomy term causes results to collapse but they never expand/slide down again » JS does not work if the site is in a subfolder
Version: 5.x-1.0 » 6.x-1.x-dev
Component: User interface » Code

This raises a good point about the JS having to know what the default base_path() is....