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

  • Home
  • SEARCH
  • 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 6062871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:06:03+00:00 2026-05-23T09:06:03+00:00

Here is the html and jQuery part: <html> <head> <script type=text/javascript src=jquery-1.3.2.js></script> </head> <body>

  • 0

Here is the html and jQuery part:

<html>
  <head>
    <script type="text/javascript" src="jquery-1.3.2.js"></script>
  </head>

  <body>      
   <script type="text/javascript">

    $('document').ready(function(){

       $('#submit').click(function(){

          var username=$('#user').val();

          $.post('http://localhost:8080/verify/comment.php',
                 {
                   user:username
                 },
                 function(return_data)
                 {
                   alert(return_data);
                 }
           );
       });

   });
  </script>

   Username:<input type="text" id="user"/>
   <input type="button" id="submit" value="submit"/>

 </body>
</html>

comment.php

 <?php    
    echo 'welcome';
 ?>

It displays an empty alert message.. I can’t get the value “welcome” in alert message……..
Any suggestion…….?

  • 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-23T09:06:03+00:00Added an answer on May 23, 2026 at 9:06 am

    Ohhh… my eyes just went crazy rolling by looking at this code. So many things you are doing wrong… Where to start?

    1. Current jQuery version is 1.6, not 1.3.2.
    2. Your HTML is not valid. You don’t have a form element.
    3. You don’t listen for a click event on the submit button, but for a submit event on the form.

    This should be working for you:

    <html>
        <head>
        </head>
        <body>
            <script type="text/javascript" src="jquery-1.3.2.js"></script>
            <script type="text/javascript">
                $(document).ready(function(){
                    $('#login').submit(function(e){
                        // prevent form submit, so we can do a manual one
                        e.preventDefault();
    
                        var username = $('#user').val();
                        $.post('http://localhost:8080/verify/comment.php', {user:username}, function(return_data){
                            alert(return_data.message);
                        }, 'json');
                    });
                });
            </script>
            <form id="login" action="" method="post">
                <label for="user">Username:</label>
                <input type="text" id="user"/>
                <input type="button" id="submit" value="submit"/>
            </form>
        </body>
    </html>
    

    Here is your PHP, which echos a json_encode()d string, for context (notice how we accessed returned_data.message on the above code:

    <?php
    $return_data = array(
        'message' => 'Welcome'
    );
    echo json_encode($return_data);
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my jQuery using delegate and ajax: $(.tweets).delegate(#fav #submit, click, function(){ var favid
Here is the input (html, not xml): ... html content ... <tag1> content for
Here is an example of polymorphism from http://www.cplusplus.com/doc/tutorial/polymorphism.html (edited for readability): // abstract base
I'm using an HTML sanitizing whitelist code found here: http://refactormycode.com/codes/333-sanitize-html I needed to add
Does anyone here has any experience on how to send HTML emails that renders
Here's the problem: 1.) We have page here... www.blah.com/mypage.html 2.) That page requests a
Using preview 4 of ASP.NET MVC Code like: <%= Html.CheckBox( myCheckBox, Click Here, True,
In my main page (call it index.aspx ) I call <%Html.RenderPartial(_PowerSearch, ViewData.Model);%> Here the
I am following a tutorial from nettuts, specifically here: http://blog.themeforest.net/tutorials/jquery-for-absolute-beginners-day-11/ I am 3/4's of
We wish to use jquery/javascript to add 'alternate link rss' elements in the section

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.