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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:41:23+00:00 2026-05-15T20:41:23+00:00

languages used: html, javascript/jquery, and php 5.2 So I created this function that onclick

  • 0

languages used: html, javascript/jquery, and php 5.2

So I created this function that onclick creates a “group”. For simplicity, we’ll say this is a group (aka the response from ajax.):

<div id="group1">Group #1</div>

This is where the groups go: (html page)

<div id="groups">
    <!-- groups go here -->
</div>

So the user creates group #1. No problem. The response is returned and Group 1 appears on the screen where it should.

The problem I run into is when the user creates group #2.

success:function(data){
                    $('#groups').prepend().html($.trim(data));
                }

The above script is what assigns the new group to the div. The trouble is, instead of prepend group2 before group1, group2 replaces group1. (not good)

I’m not exactly sure what is happening but when the user creates a 2nd group the script looks for a child element of group to prepend the script finds none so it replaces group1.

If I go to view source I do not see the div for group1 or two but I can visually see the response on my screen.

What is going on here and how do i fix it?

Thanks!

  • 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-15T20:41:24+00:00Added an answer on May 15, 2026 at 8:41 pm

    If your response is HTML, you can do it like

    $("#groups").prepend(data);
    //or
    $(data).prependTo($("#groups"));
    

    What you’re doing is prepend()ing nothing, and then setting #groups‘ html to the data

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

Sidebar

Related Questions

I'm used to scripting languages. PHP, Javascript etc. and I've written a few relatively
I had used jquery media plugin to display pdf file in html This is
What mix of languages and other elements are used in gmail. HTML, JavaScript, AJAX(?),
I came across this line in a book on WCF: ...and the languages used
We found a JQuery plugin called FixedTable that is used to add scroll bars
I am used to structural programming (eg:C), OO programming(eg:Java), Scripting(eg:Javascript), Web (eg:HTML,JSP,Servlets,CSS) etc. Now,
Hi i have a Javascript function that replaces needle's in a haystack as you
I come from a background of 1 year programing in html/css/javascript/jQuery and 6 months
question: I am working with jQuery sortable. I used this tutorial: http://www.xmech.net/programming/jquery-ui-sortable-tutorial/ Now this
What languages can be used to develop for the iPhone? I know, I know:

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.