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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:18:13+00:00 2026-06-13T14:18:13+00:00

Well I have spent a while scouring the internet for what I’d seem to

  • 0

Well I have spent a while scouring the internet for what I’d seem to be a simple solution.
I’ll show you the code and the ajax template I have been looking at.

<form style="padding:10px 2px;" name="test" class="searchform" action="#" method="GET">
<input style="margin-top:22.5px;" name="input_value" type="text" class="searchbx" size="" placeholder="Search songs..." />
<select name="cbb">
<?php
echo "<option value='artist'>$Artist</option>";
echo "<option value='name'>$Title</option>";
?>
</select>
<input id="sa" style="position:absolute;margin-top:35px;width:90px;" name="submit" type="submit" class="searchbutton" value="OK" />
</form>
<div id="sidebar-query-results">
         <ul id="current-list" style="list-style: none; padding: 0;">
<?php
if (isset($_GET['submit']))
{
// Execute this code if the submit button is pressed.
if (empty($_GET['input_value'])) {
die();
}
include "db_config.php";

$input_value = $_GET['input_value'];
$combo_box_value = $_GET['cbb'];
echo $formvalue;
echo $cbbvalue;
$query =  "SELECT * FROM `links` WHERE `$combo_box_value` LIKE '%$input_value%' LIMIT 0, 20" ;   
$result = mysql_query($query);
if($result) {
while($row = mysql_fetch_assoc($result)){
$cover = $row['cover'];
$title = $row['title'];
$name = $row['name'];
$artist= $row['artist'];
$url = $row['url'];

The rest of the script is simply printing the results etc.

The script itself Works like a charm although I understand it’s very “scruffy” but, functionality is all that I am really concerned about at the moment.

Anyway here is the ajax template:

 <script>
 $('form[name="test"]').submit(function(e) {
 e.preventDefault();

 $.ajax({
 url : #.action,
 type : this.method,
 data : $(this).serialize(),
 success : function(response) {

 }
 });
 });
 </script>

Either way it’s just the ajax script that I can’t get to work the php script I really don’t want to have to alter, I have looked dozens of tutorials but, I am having a lot of trouble implementing them into my situation.

  • 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-06-13T14:18:14+00:00Added an answer on June 13, 2026 at 2:18 pm

    That’s because the script is actually causing a syntax error so your AJAX binding isn’t occurring as expected (the entire <script> is being rejects so therefore it’s not being bound to the submit event and never calling .preventDefault())–Mostly because of the following:

    url : #.action,
    

    Try changing that to use:

    url : $(this).prop('action')
    

    (If you want to reference the <form action="..."> attribute) otherwise use a string like url: '/submit.php',

    A more universal script would be something like:

    $('form.ajax').on('submit',function(e){
      var $form = $(this);
      $.ajax({
        'type': $form.prop('method'),
        'url': $form.prop('action') || document.location,
        'data': $form.serialize(),
        'success': function(response){
          // handle response
        }
      });
      e.preventDefault();
    });
    

    Then you can add the ajax class to any form you’d like to be enhanced with ajax (and of course those without javascript support would default back to “traditional” methods).

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

Sidebar

Related Questions

I have this code that works well: {livre:empty_name} $.ajax({ url: sent.php, type: post, dataType:
Well i have a div tag that i show as a modal dialog this
Well I have been writing in the same style for awhile now and all
I have trawled the API and spent two nights staring at this code and
I have been doing SQL for a while and I've always been satisfied to
I have been trying to figure this out for a while now, but every
I have spent quite a while trying to solve this problem, but to no
I have spent almost the whole day trying to find a solution to this
I've spent a while reading up on this and have yet to find an
Background: I've spent a while working with a variety of device interfaces and have

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.