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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:26:31+00:00 2026-05-25T06:26:31+00:00

I am trying to refresh the div that contains a table that show the

  • 0

I am trying to refresh the div that contains a table that show the data after a successful insertion of new data using ajax.

Here’s my code:

            $("span.save").live('click', function() { 

                var id = $(this).attr('id');
                var name = $('.ingr_name_' +id).val();
                var amount = $('.amt_' +id).val();
                var unit = $('.unit_' +id).val();

                if(name.length > 0 && amount.length > 0 && unit.length > 0)
                {   
                    var dataString = "id=<?php echo $this->uri->segment(3); ?>&name=" +name +"&amount=" +amount +"&unit=" +unit;

                    //alert(dataString);

                    $.ajax({
                       type: "POST",
                       url: "<?php echo base_url(); ?>recipe/add_ingr",
                       data: dataString,
                       success: function(){                         
                           //I wanted to refresh the div here. Where the div's id="ingredients_list"

                           alert('Recipe ingredient added.')
                       },
                       error: function(xhr, status, error) {
                            alert(error)
                       }
                    });

                    return false;
                }
                else
                {
                    alert("Please fill out all fields.");   
                }

            });

I’ve been searching how to do the div refresh but they don’t fit my needs for this problem. Can anyone help me with this? Thank you for your 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-25T06:26:31+00:00Added an answer on May 25, 2026 at 6:26 am

    In the success handler of the ajax call you will get a response in the first argument. Using that you can create the desired markup and then append it into ingredients_list element.

    success: function(response){
        //Using response object create the desired markup for recipe table 
    
        $("#ingredients_list").html("markUpCreatedUsingResponseFromServer");
        alert('Recipe ingredient added.')
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to have a div refresh after a callback using ajax functions. Basically,
I am trying to display data after being submitted with ajax. The ajax works
How do you do dynamic refresh of a single div tab using php/ajax and
I'm trying to refresh a div with jquery that loads the time which is
I am trying to refresh a UITableView with new cells every 30 seconds. My
I am trying to use periodic refresh(ajax)/polling on my site by XMLHttp(XHR) to check
What i am trying to do here is to show a couple of validation
I am creating a dynamic div using Jquery and I am trying to cache
I'm trying to make my jQuery code refreshing the div after deleting a post.
I am trying to get the div recentactivity to only refresh when Remove is

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.