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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:38:53+00:00 2026-06-13T11:38:53+00:00

I am working with jQuery. I need to insert data into database in webapi

  • 0

I am working with jQuery. I need to insert data into database in webapi (mvc4) here I have data in <p> now I need to insert that data into database.

Here is my code:

 <script type="text/javascript">
     $(document).ready(function () {
     $('#btndiv1').hide();
     $('#btndiv').hover(function () {
        $('#btndiv1').show();
    });
    });
 </script>
     <script type="text/javascript">
    $(document).ready(function () {
    var editor = CKEDITOR.editor.replace('editor1');
    $('#btndiv').mouseleave(function (event) {
        $('#btndiv1').hide("slow");
            alert(1);
            var value = editor.getData();

            $('#btndiv').append(value);
        // send your ajax request with value

            var dataToPost = JSON.stringify(value);
            alert(dataToPost);
            ale(value);
            $.ajax({
                type: "POST",
                url: "/CkeditrorData/create",
                contentType: "application/json; charset=utf-8",
                data: dataToPost,
                dataType: "json",
                success: function () {
                    // do what you want on success.


                }
            });
        });
    });

</script>

and here is my html:

     <h4>design your own text</h4>
<div id="btndiv" >
    <div id="btndiv1" style="height:auto;width:auto; border:solid 1px;">
    <textarea  rows="10"   id="editor1" "></textarea>
    <p id="text" ></p>
        </div>
</div>

Now I have data in <p> tag above; I need to insert data into the database. How could I do this? Could you please help me?

  • 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-13T11:38:54+00:00Added an answer on June 13, 2026 at 11:38 am

    You need to make an ajax call to your action, which will make an insert to the database.

    Below is a very simple ajax call,

    var Contact = {
    Lastname: 'Smith',
    Firstname: 'John'
    };
    
    var dataToPost = JSON.stringify(Contact);
    
    $.ajax({
        type: "POST",
        url: "/contacts/create",
        contentType: "application/json; charset=utf-8",
        data: dataToPost,
        dataType: "json",
        success: function(){
            // do what you want on success.
        }
    });
    

    On server create a class with a similar structure for the contact class.

    public class Contact
    {
    public string Lastname { get; set; };
    public string Firstname { get; set; };
    }
    

    below is the action to which the values will be posted using jquery.

    [HttpPost]
    public string Create(Contact contact)
    {
        // insert this contact to db.
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this JQuery code working however I need to know whether how to
I have a jQuery code, but need it working by using Mootools: if (
im working on this jquery data entry form in which i need a specific
I am working with jQuery UI slider . Here is the code i am
I have an ancient webpage that I need to instill some databasing capabalities into
I'm working with jquery. I have an anchor tag that is generated dynamically in
Need a working code example on how to insert text at the cursor position
jQuery need content append to another html tag , my code is not working
I'm working on a Django project that will need jQuery, jQuery UI , and
Need help in jquery: here is a schema of code: submit form through jquery

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.