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 7675601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:59:55+00:00 2026-05-31T16:59:55+00:00

I have a problem with Javascript that keeps bugging me for quite a while

  • 0

I have a problem with Javascript that keeps bugging me for quite a while now. I have an external file called search.js which is in the same folder as the .html file it’s loaded into.

The piece of code I use in th HTML to load the javascript file is:

<script type="text/javascript" src="search.js"></script>

From all the websites I’ve read I can’t find an issue here with the code.

Also, I know that the syntax in the javascript file has to be correct in order for it to work, so here is my Javascript code from search.js:

$(document).ready(function(){
    $('#searchForm').submit(function(){
        var lookfor = $("#billSearched").val();
        alert(lookfor);
        var a = $(this).attr('action');
        alert(a);
        a = a.replace("__search_term__",lookfor);
        alert(a);
        window.location.href = a;
        return false;
    });
});

I’ve runned this code in another project and it has worked just fine, all that I’ve changed was the names of the fields, i.e. billSearched.

If there are any other reasons for why Javascript doesn’t load in my page please leave a message or a comment.

Thanks in advance!

EDIT

Full html code:

<html>
<head>
    <title>Bills</title>
    <script type="text/javascript" src="/jquery-1.7.1.min.js"></script>
    <script type="text/javascript" src="/search.js"></script>
    <link rel="stylesheet" href="style.css"> 
</head>
<body bgcolor="#0066CC" color="FFFFFF">
    <table>
        <tr>
            <td style="color:white"><b>Products</b></td>
            <td style="color:white">Price</td>
            <form method="POST" id="searchForm"  action="{% url ps.views.search searchTerm='__search_term__' %}">
                {% csrf_token %}
                <td><input type="text" id="billSearched"></td>
                <td><input type="submit" value="Search"></td>
            </form>
        </tr>
        {% for x in products %}
        <tr>
        <td style="color:white">{{ x.name }}</td>
        <td style="color:white">{{ x.price }}</td>
        </tr>
        {% endfor %}
    </tr>
</table>
</body>

  • 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-31T16:59:56+00:00Added an answer on May 31, 2026 at 4:59 pm

    I had to make a mix of your answers in order to fix the problem but eventually it was fixed. I had to make the following modifications:

    • Add the ‘/static/’ folder to STATIC_URL and STATICFILES_DIRS in the settings.py file
    • Import the .js files (search.js and the jQuery source) with the following commands, in this order:

      <script type="text/javascript" src="/static/jquery-1.7.1.min.js"></script>
      <script type="text/javascript" src="/static/search.js"></script>
      
    • And make the according file structure, placing the “static” file in the project’s root directory.

      i.e.
      Psroot:

    • psApp
    • static
    • templates
    • and the rest of the files (settings.py, urls.py, manage.py, etc.)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a (hopefully quite simple) Javascript problem. I've search but found nothing that
I have a problem with a javascript set of functions that I made. This
So I have a rather basic javascript problem which I have been slamming my
Right now, we have a slideshow of images that uses javascript. However, when the
I have a countdown timer in javascript that is called by a code behind
I have a problem with Javascript Literal functions. for (curitem in array) { var
I have a problem with a javascript error: $(#slider) is undefined How can i
I have problem with dynamically created image (JavaScript). I want to change the innerHTML
I have a little problem with javascript form submit issue, here is the script
Hi I have a problem with a javascript string var foo = \<a href=javascript(foo('a','b'))>test</a>\

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.