Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have added a custom Google Search to a site and while the search box functions the results page is pathetically empty.

Here is the search box code:

<form action="http://www.nu-living.com/info/search_results" id="cse-search-box">
<div>
<input type="hidden" name="cx" value="017425724926122041548:jqyv4auvnls" />
<input type="hidden" name="cof" value="FORID:9" />
<input type="hidden" name="ie" value="UTF-8" />
<input type="text" name="q" size="31" />
<input type="submit" class="submit" name="sa" value="Search" />
</div>
</form>
<script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&amp;lang=en"></script>

Here is the display code:

<div id="cse-search-results"></div>
<script type="text/javascript">
var googleSearchIframeName = "cse-search-results";
var googleSearchFormName = "cse-search-box";
var googleSearchFrameWidth = 900;
var googleSearchDomain = "www.google.com";
var googleSearchPath = "/cse";
</script>
<script type="text/javascript" src="http://www.google.com/afsonline/show_afs_search.js"></script>

The site: http://www.nu-living.com

The search results page: http://www.nu-living.com/info/search_results

I have done this on several other sites with success, but this one is just not cooperating. I would appreciate any assistance in getting this to work correctly

share|improve this question

migrated from stackoverflow.com Nov 12 '10 at 22:13

This question came from our site for professional and enthusiast programmers.

add comment

1 Answer 1

Two Three things you need to look at (one related, one two unrelated) from the FireFox error console

(javascript) Error: uncaught exception: Syntax error, unrecognized expression:

Unrelated but still worth correcting:

Warning: Unexpected end of file while searching for selector. Source File: http://www.nu-living.com/ Line: 0

... and:

(parsing) Error: The stylesheet http://www.nu-living.com/css/about.css was not loaded because its MIME type, "text/html", is not "text/css". Source File: http://www.nu-living.com/info/search_results/?cx=017425724926122041548%253Avgp5w3d356w&cof=FORID%253A9&ie=UTF-8&q=testing&sa=Search&siteurl=www.nu-living.com%252F Line: 0

Also, is there a good reason you are including jQuery and related Javascript file references in the body of your HTML document?

Update: A problem on your homepage here:

<script type="text/javascript">
  $('#breaking-news ul').newsticker();
  $('#slideshow').cycle();
</script>

You should wrap all jQuery calls in $(document).ready(function() { /* code */ }); to ensure the DOM is ready before you change things - otherwise you'll hit a Javascript error which may prevent other scripts from running if jQuery hasn't had a chance to initialize the $ variable.

I would wager that this is what is happening with Google Custom Search - a problem with one of your other scripts is breaking script execution before the search script can run.

You should debug your site to correct these problems - FireBug may help with this task.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.