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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:49:59+00:00 2026-05-14T14:49:59+00:00

I am populating a list of names that will be added to my Sql

  • 0

I am populating a list of names that will be added to my Sql Database. In this simple case, how do I send the information to SQL server without my page being refreshed?

<script type="text/javascript">
function addNewRow() { 
    $('#displayPropertyTable tr:last').after('<tr><td style="font-size:smaller;" class="name"></td><td style="font-size:smaller;" class="address"></td></tr>');
    var $tr = $('#displayPropertyTable tr:last');
    var propertyCondition = $('#txtPropAddress').val();
    if (propertyCondition != "") {
        $tr.find('.name').text($('#txtPropName').val());
        $tr.find('.address').text($('#txtPropAddress').val());        
    }
} 
</script>
...
<table id="displayPropertyTable" width= "100%">
<tr>
     <td style="font-size:smaller;" class="name"></td>
     <td style="font-size:smaller;" class="address"></td>
</tr>
</table>
...
<table>
<tr>
     <td><b>Name</b></td>
     <td colspan="2"><input id="txtPropName" type="text" /></td>
</tr>
<tr>
     <td><b>Address</b></td>
     <td colspan="2"><input id="txtPropAddress" type="text" /></td>
</tr>
</table>
...
<button onclick="addNewRow();">Add</button>
  • 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-14T14:50:00+00:00Added an answer on May 14, 2026 at 2:50 pm

    Using AJAX via JQuery’s getJSON() is a method I use a lot. getJSON() is a wrapper for the ajax() method I believe.

    Here’s an example of JS Method that serializes the form data and does an ajax request passing the serialized data.

    If successful in this case you can pass back a Json Object. In my example I simply pass back a string that says “Success”. So you will see an alert box now displaying Success in it, for my simple example.

    function addRowsViaAJAX() {
    
        var d = new Date(); // IE hack to prevent caching
    
        $.getJSON('/ControllerName/ActionName', { Data: $('#MyForm').serialize(), Date: d.getTime() }, function(data) {
            // callback on success
            alert(data);
        }, 'json');
    }
    

    In you controller here’s an example of an Action to use for AJAX
    Your data comes in serialized as a linear string so you will have to parse it, which is pretty easy. Then take the data and do your respective database logic. Then return a Json Object.

    public virtual JsonResult ActionName(string data)
    {
       // take the data and parse the linear stream... I like to use the FormCollection
       FormCollection collection = new FormCollection();
    
       foreach (string values in data.Split('&')){
         string[] value = values.Split('=');
         collection.Add(value[0], value[1]);
       }
       // Now do your database logic here
       return Json("Success");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a dropdownlist that populates from the sql server database. populating the list
i have a list: <asp:ListBox ID=lstProblems runat=server SelectionMode=Multiple></asp:ListBox> and i am populating it this
I have a ComboBox that I am populating with a list of parts for
I am using a ToolStripComboBox to list some data. I am populating this combo
Scenario: I have an application (C#) that expects a SQL database and login, which
I'm populating a listview with a list of databases on a selected SQL instance,
I have a page that shows a map and a list of names. The
I have a simple form that lists user names and for each user, the
I am having issues populating a List of User defined object attributes in Struts2.
1.) My main.xml contains : <ListView android:id="@+id/lsym" android:layout_width="wrap_content" android:layout_height="wrap_content"/> 2.) After populating the list,

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.