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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:28:00+00:00 2026-06-14T12:28:00+00:00

The page’s link is: localhost/mysite/create-user This is the code: <form class=form-horizontal name = signUp1F

  • 0

The page’s link is: localhost/mysite/create-user

This is the code:

        <form class="form-horizontal" name = "signUp1F" id = "signUp1F">
            <input class="input-xlarge focused" name="pskil" id ="pskil" type="text" placeholder = "Doctor, Trainer, Human Resource etc.">
            <input type="hidden" name="neoid" id="neoid" value="<?php echo $neoid; ?>" />
            <span><button id = "plus" class="btn btn-success">Plus</button></span>
            <div id="skillsAdded"></div>
        </form>

The jquery code:

<script type="text/javascript">
    $('#plus').click( function(event){
        var pskil = $('#pskil').val();
        var neoid = $('#neoid').val();
        if( !pskil){
            alert( "Please write a skill.");
            return false;
        }

        $.ajax({
            type: 'post',
            url: "localhost/mysite/add-skill",
            data: { pskil: pskil, neoid: neoid},
            success: function( response){
                $('#skillsAdded').append( pskil + "<br>");
                return false;
            }
        });
    });
</script>

The purpose is this: user enters a skill value to the input, clicks the Plus button, an ajax request is sent to add the skill to the database. And the code that handles this request is on localhost/mysite/add-skill.

But things go wrong. When I click the “plus” button, it goes to the page localhost/mysite/create-user?pskil=php&neoid=53. What can possibly make this direction? I’ve been working on this issue for almost 2 hours and I cannot manage to handle it.

  • 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-14T12:28:01+00:00Added an answer on June 14, 2026 at 12:28 pm

    The issue is that your button tag submit your form. Here is a updated JavaScript source that you can use. jQuery got a built in preventDefault() method for events. This will for an example prevent the button to submit the form.

    <script type="text/javascript">
        $('#plus').click( function(event){
            event.preventDefault();
    
            var pskil = $('#pskil').val();
            var neoid = $('#neoid').val();
            if( !pskil){
                alert( "Please write a skill.");
                return false;
            }
    
            $.ajax({
                type: 'post',
                url: "localhost/mysite/add-skill",
                data: { pskil: pskil, neoid: neoid},
                success: function( response){
                    $('#skillsAdded').append( pskil + "<br>");
                    return false;
                }
            });
        });
    </script>
    

    Tryout: http://jsfiddle.net/3A7Mg/1/

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

Sidebar

Related Questions

Page code as below: <input type="radio" class="direct" name="r1" value="first" /> <span class="proxy">radio1</span> <input type="radio"
page = 1; $('.links').click(function() { $(this).removeAttr('href'); page = $(this).html(); }); <a href=# class=links> 1
Page contains single form with input elements and jqgrid data. jqGrid data is retrieved
My page consists of the following code: @{ var db= Database.Open(Surgestuff); var sqlQ =
The page is here: https://gentle-day-3026.herokuapp.com/ The css file like this: https://gentle-day-3026.herokuapp.com/stylesheets/base.css another is to
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Basically, what I'm trying to create is a page of div tags, each has
Page 120 of Programming Pearls 1st edition presents this algorithm for selecting M equally
page--node--edit.tpl.php works just fine when you want to create a specific template for editing
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.