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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:48:58+00:00 2026-05-25T12:48:58+00:00

please take a look of this: $(function () { $(#add).click(function() { val = $(‘#add_lang’).val();

  • 0

please take a look of this:

$(function () {

    $("#add").click(function() {

       val = $('#add_lang').val();
       val1 = $('#add_lang_level').val();

       listitem_html = '<li>';
       listitem_html += val + ' <strong>('+ val1 + '/100)</strong>';
       $.ajax({ url: 'addremovelang.php', data: {addname: val,addlevel: val1}, type: 'post', success: function(output) { alert(output); }});
       listitem_html += '<a href="#" class="remove_lang">Remove</a>'
       listitem_html += '</li>';

        $('#langs').append(listitem_html);

    });

    $('.remove_lang').live('click', function(e) {

       e.preventDefault();
       $(this).parent().remove();
       $.ajax({ url: 'addremovelang.php', data: {delname: val}, type: 'post', success: function(output) { alert(output); }});

    });


});

This simple jquery script adds strings to a html list when the user hits the button with the id add. Also, it puts a remove link to each line, so when the user hits remove it triggers the function remove_lang and the string is deleted.

When the users add a string, this text comes from a text field, and i stored it on the variable val (as you can see on the 5 line of the code). Then i call a php script via Ajax to add this info to my mysql database.

But, when the user remove the string, i dont know how to know what string was removed, i mean, the name of this one, that i need to send to my php script in order to remove it from the database.

Take a look of this version of my code without the ajax call: http://jsfiddle.net/wnFsE/

Thanks for any help!!!

  • 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-25T12:48:59+00:00Added an answer on May 25, 2026 at 12:48 pm

    When you click remove you can do something like this:

        val = $(this).parent().find('input').val();
    

    That will get the value from hidden input you added:

    Demo Here

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

Sidebar

Related Questions

Take a look to this function please function CheckHost() { $url = parse_url($_SERVER['HTTP_REFERER']); $host
Please take a look at this page. I wrote click functions for each button
please take a quick look at this function that I have found on the
Before I ask my question, please take a look at this example function: DateTime.TryParse(01/01/2000,
Please take a look at this code: class Foo { public $barInstance; public function
Please take a look at this function: var msgdiv, i=0; msgdiv=$(#message); messages=[Welcome!,Добро пожаловать!]; function
Please take a look at this: http://jsfiddle.net/tmPfV/ If you click right the box moves
Please take a look at this example: #include <iostream> #include <vector> #include <string> using
Please take a look at this code: template<class T> class A { class base
Please take a look at this piece of code I came up with. abstract

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.