JS does not work if the site is in a subfolder
jgumpert - March 20, 2009 - 00:24
| Project: | Taxonomy Quick Find |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
| Issue tags: | Aix, developer, development, développement, développeur, emploi, France, hiring, Job Offer, Job Posting, Marseille, PACA |
Jump to:
Description
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?
| Attachment | Size |
|---|---|
| tqf-initial-display.png | 13.7 KB |
| tqf-after-select.png | 2.96 KB |

#1
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?
#2
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/.
#3
Please consider this job offer:
EN: Taxonomy_Quick_Find.module PAID bugfixes and development.
FR: REMUNERATION développement et bugfix de Taxonomy_Quick_Find.module.
#4
Hi
Can you provide some more from the example that you have done ?
thank you
#5
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...
#6
This raises a good point about the JS having to know what the default
base_path()is....