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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:02:19+00:00 2026-06-05T22:02:19+00:00

I just fiddled following script. It’s not working. <SCRIPT> function kin() { var kobj

  • 0

I just fiddled following script.
It’s not working.

<SCRIPT> 

function kin() {
    var kobj = document.getElementById("k"); // input Object 
    var q = kobj.value; 

       $.ajax({
      type: "POST",
      URL: "zips.php",
      data:q,
      success: function(res) {
            $("#result").append(res);
            console.log(res);
      }
   });

}

</SCRIPT> 

 <INPUT type="text" autocomplete="off" value="" id="k"><input type="submit" value="search" onClick="kin()" data-role="button">      
<DIV id="result"></DIV>
  • 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-05T22:02:21+00:00Added an answer on June 5, 2026 at 10:02 pm

    I noticed two errors in the code you posted. I commented old code, so you can easily notice changes.

    <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
    
    <SCRIPT> 
    
    function kin() {
        //var kobj = document.getElementById("k"); // input Object 
        //var q = kobj.value; 
    
        var q = $("#k").val();
    
           $.ajax({
          type: "POST",
          url: "zips.php",
          //data:q,
          data: "q="+q,
          success: function(res) {
                $("#result").append(res);
                console.log(res);
          }
       });
    
    }
    
    </SCRIPT> 
    
     <INPUT type="text" autocomplete="off" value="" id="k"><input type="submit" value="search" onClick="kin()" data-role="button">      
    <DIV id="result"></DIV>
    

    JQuery allows you to rewrite the code you posted like this:

    <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
    <SCRIPT> 
    
    $(document).ready(function() { 
        $("#submit").click(function(e) {
          e.preventDefault();
    
          var q = $("#k").val();
    
          $.ajax({
              type: "POST",
              url: "zips.php",
              data: "q="+ q,
              success: function(res) {
                    $("#result").append(res);
                    console.log(res);
            },
          });
    
        });       
    
    });
    
    </SCRIPT> 
    
     <INPUT type="text" autocomplete="off" value="" id="k"><input type="submit" id="submit" value="search" data-role="button">      
    <DIV id="result"></DIV>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: $(document).ready(function () { $(tr).live('click',function(){ alert(TR); }); $(input).live('click',function(){ alert(INPUT); });
I have the following code: $(document).ready(function() { var $body = $(body); for (var i
I have the following code: <html> <script> setInterval(settime(), 1000); function settime () { var
The following code operates a JQuery based horizontal animation system. $(document).ready(function(){ maxWidth = 700;
I am trying to enumerate and build the following fiddle with Mustache.js: $(function ()
I use the following to implant a script into random websites: (added by webmasters
I am just learning how to define a function and call it back later.
In this fiddle I'm just trying to return true : http://jsfiddle.net/WCFtp/ for jQuery key
Here is my Fiddle: http://jsfiddle.net/LLFpp/ I'm just starting to learn CSS and Divs (moving
See the fiddle: http://jsfiddle.net/stefek99/9m5NZ/1/ Get the source: http://pastie.org/3654715 Chrome 17 : just works. IE

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.