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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:40:17+00:00 2026-06-06T11:40:17+00:00

I am having trouble displaying results recieved from asp.net WebMethod. I have a HTML

  • 0

I am having trouble displaying results recieved from asp.net WebMethod. I have a HTML template and fill in the results from JSON response. The problem is that the first response is being displayed once, the second is displayed 2 times, the third 4 times, the fourth 8 times and so on . Here is the jQuery (I need to reference “d” first because the response is comming from asp.net and they put it there automatically)

     function fnGetContent(keyword) {
            var NewKeyword = keyword.tag;
            var type = keyword.type
            var oldresults = $("#fillresultsdiv").html()
            $('#hidQueryType').val('tagsearch');
            $.ajax({
                type: "POST",  //GetEvents(iType As Integer, sSearch As String)
                url: "Default.aspx/GetEvents",
                data: "{'iType':'" + type + "','sSearch' : '" + NewKeyword + "' }",
                contentType: "application/json; charset=utf-8",
                dataType: "json",

                success: function (msg) {
                    var events = [];
                    var obj = $.parseJSON(msg.d);

                    $.each(obj.res, function() {
                        var newRow = $('.Template').clone();

                        // Now loop through the object
                        for (var prop in this) {
                            if (this.hasOwnProperty(prop)) {

                                // Lucky for you, the keys match the classes :)
                                $('.' + prop, newRow).text(this[prop]);
                            }
                        }
                        $('#fillresultsdiv').append(newRow);
                    });

There is only one entry in the JSON for each event, it is the jQuery code that is making this happen, sample response:

 {"d":"{\"res\":[{\"day\":\"26\",\"dayofweek\":\"Tue\",\"month\":\"Jun\",\"title\":\"Glen Hansard\"
       ,\"venue\":\"Vic Theatre\",\"time\":\"7:00 PM\",\"ticketurl\":
        \"http://seatgeek.com/glen-hansard-tickets/chicago-illinois....
  • 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-06T11:40:18+00:00Added an answer on June 6, 2026 at 11:40 am

    Each time you call

    var newRow = $('.Template').clone();
    

    You are creating a copy of all the elements that have the “Template” class. You are then appending all these copies to your element with id “fillresultsdiv”. Each one of these copies also has this “Template” class applied to it, so the next time you clone, you are picking up the previously cloned copies.

    The first time you call it there is only one row, the second time 2, then 4, then 8, etc.

    You can probably just change the cloning line to

    var newRow = $('.Template').clone().removeClass("Template");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having trouble displaying an background image in my ASP.NET MVC 2 application.
I am having trouble displaying an image from the internet on my html page.
I'm having trouble displaying an image in a UIWebView. I retrieve html content from
I am having trouble displaying results from a SQL query. I am trying to
I'm having some trouble with displaying results from a datasource. This code will show
I'm having trouble with displaying image from db. I think that method for saving
I am having trouble displaying a webview. I have a webview inside a custom
I'm having trouble displaying a Rails form in a horizontal line. I have a
I have a simple login page but i am having trouble displaying the logged
I'm having trouble performing a search operation in the background, and displaying the results

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.