Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 213141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:15:03+00:00 2026-05-11T18:15:03+00:00

I have tested the below script on a demo page which is not using

  • 0

I have tested the below script on a demo page which is not using any CMS.
The script is located in the index.php file and works just fine.

<form method="get" action="">
  <input id="label_search" type="text" value="" maxlength="40" name="inputText"/>
</form>

<script type="text/javascript">
  var options = {
      script:"includes/autosuggest.php?json=true&",
      varname:"input",
      minchars: 2,
      delay: 200,
      json:true,
      shownoresults:false,
      maxresults:15,
      timeout: 5000
  };

  var as_json = new bsn.AutoSuggest('inputText', options);
</script>

Now I want to use the same code in a WordPress template file.
But nothing is happening. Seems like the script is not triggering at all.

I’m using user friendly URL’s and have set custom permalinks to /%category%/%postname%.
Maybe that has something to say?

I know the bsn.AutoSuggest_2.1.3.js is running, because an “alert(‘hello’)” test on the file is executed on page load.

What could be wrong?

This is my WP code:

sl_startpage.php:

<?php
/*
Template Name: SL - Start page
*/ 
  get_header(); ?>
  <div id="myArea">
  <?php
    include_once('includes/storeLocator/sl_header.php');
  ?>
  </div>

<?php 
  get_footer(); 
?>

This is the (simplyfied) code in sl_header.php:

  <div id="sl-header">
    <form method="get" action="">
      <input id="label_search" type="text" value="" maxlength="40" name="product_search"/>
    </form>                   
  </div>


  <script type="text/javascript">
    var options = {
        script:"includes/autosuggest.php?json=true&",
        varname:"input",
        minchars: 2,
        delay: 200,
        json:true,
        shownoresults:false,
        maxresults:15,
        timeout: 5000
    };
    var as_json = new bsn.AutoSuggest('product_search', options);
  </script>

Any suggestions anyone?

This is the plugin I use:
http://www.brandspankingnew.net/archive/2007/02/ajax_auto_suggest_v2.html

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T18:15:04+00:00Added an answer on May 11, 2026 at 6:15 pm

    Alright!
    After about 20 hours of research, I found the answer in a blog by Ryan Pharis.
    As I was suspecting, it was an easy solution.

    WordPress is using “user friendly URLS”.
    Therefore my path ended up like this:
    http://www.mysite.com/includes/autosuggest.php?json=true&amp;

    The REAL path is this:
    http://www.mysite.com/wp-content/themes/my_theme/includes/autosuggest.php?json=true&amp;

    My script cannot be located in an external .js script, because I need to get the URL from WordPress. So I did this:

    <?php $site_url = bloginfo('template_url'); ?>
    
     <script type="text/javascript">
        var options = {
            script:"<?php echo $site_url; ?>includes/autosuggest.php?json=true&",
    

    Now my script works and I’m a happy camper.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried using a example file using PHPExcel script to extract data from
I have a file download script that I have written, which reads files from
I am using the PHP script below to test FTP connections. Currently it is
have not tested on windows. but in ubuntu when u disconnect from the network,
Under my project, I have a Java class file, inside of which I have
I have a multi-threaded script which occasionally freezes when it connects to a server
I have recently encountered a problem in IE, using the jQuery UI datepicker script:
Using the script task below to stuff list of files into User::ftp_file_list. But, the
I have tested all my systems developed in Delphi (in Windows XP) on Wine
I have tested this servlet and it works well, except in Google Chrome it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.