Overview
So I've got this site I've been working on for months. I thought I had it all figured out. But then I Google'd for my site, and clicked a link, and the same functionality does not work.

Details
Site: http://whentoplant.com/


Walkthrough - Everything seams to work
Ok, lets walk through this so you can see what's going on.

Type into your browser: http://whentoplant.com/tom
You should get some search results that loosely match "tom".

Type into your browser: http://whentoplant.com/tomatoes
You should get the Tomatoes page.

It works! (I hope)

Walkthrough - The problem
Now go to Google and search "whentoplant.com" (don't use the quotes)
There should be a link, something like "Plants Similar To Tomatillo"
Make sure it is Tomatillo and not Tomatillos (with an 's').
The Tomatillo page does not exist because I renamed it to Tomatillos.
So clicking the link from Google should bring you to http://whentoplant.com/tomatillo
This should bring you to search for the term "tomatillo".
Ah but what's this? It doesn't work.


Further details about the problem
For some reason, it's as if all the JS works fine, but the .get function is not returning any content...something like that...when you access the site from Google.

The Offending Code
(You can go to http://whentoplant.com/ and view the source too)

$(document).ready(function() {

//On Keypress we update the search results field
$('#plantname').keyup(function() {
$.get('http://whentoplant.com/actions/search/'+escape($('#plantname').val()), 
function(data) {
//When we get the search data, we load #search_results with data.
$('#when-to-plant-instant-search-results').html(data);
}); // function data, get search results page data
}); // plantname keyup

//When page loads, if there is an existing search query, we need to load results right away
if($('#plantname').val().length > 0){
$.get('http://whentoplant.com/actions/search/'+escape($('#plantname').val()), 
function(data) {
//When we get the search data, we load #search_results with data.
$('#when-to-plant-instant-search-results').html(data);
}); // function data, get search results page data
}

}); // document ready

Desperate Plea for help
Any ideas on what could be causing this?

I can read and understand JS for the most part, but I'm not very good with JS specific terminology. Please talk plain and simple for me, code samples are great too cause I can understand that.

Any questions?

Thank you!

I understand your frustration, but cant debug somebody else's libraries.
Sometimes it gets complicated debugging pages relying on libraries you wrote yourself.

But accessing your site from any other link other than the 404 error related works just fine.

Thanks for your input troy. That's just it - How could Google possibly interfere with the functionality of the JS on my site? I don't see who it's even possible - I don't use anything with referrer or anything of the sort. That's why it gets me!

Through testing with the alert(); function, everything seams to work except the line that reads

$.get('http://whentoplant.com/actions/search/'+escape($('#plantname').val()),
function(data) {

alert(data);
}

The data variable is empty! How could this be!?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.