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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:17:03+00:00 2026-06-17T12:17:03+00:00

I am trying to build a JQuery Mobile listview (based on the getting started

  • 0

I am trying to build a JQuery Mobile listview (based on the getting started guide). The list items are populated by json data.

It is basically working. The list is being created and and styled properly. But the list includes duplicates. There are only 2 json objects, but the list includes four items. The last two are repeats of the first two.

I have double checked the json data and output the variables to the console. Both only contain the two objects, without duplicates.

Why is this jquery/javascript creating duplicate list items in the listview? How can I prevent the duplicates?

My problem may be similar to the problem described at jQuery .append() JSON data in a jQuery Mobile list adding duplicates when page is refreshed?. But the only solutions offered don’t prevent the duplicates, they only explain how to filter out the duplicates. That seems like an inefficient kludge.

Here my javascript ([live version] (http://dev.mycourtdates.com/jq.html))::

<!DOCTYPE html>
<html>
<head>
    <title>J 2.1</title>
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
    <script src="http://code.jquery.com/jquery-latest.js"></script>
    <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
</head>
<body>
    <div data-role="content">
        <ul id = "myList" data-role="listview" data-inset="true" data-filter="true">
            <script>
            $.getJSON("http://dev.mycourtdates.com/jsonData.txt?",
                {
                    id: "73125"
                },
                function(data) {
                    var items = [];

                    $.each(data, function(i,ct_setting){
                        items.push('<li><a href="#">' + ct_setting.caseNumber + '</a></li');
                    });
                    console.log(items);
                    $('#myList').append(items).listview('refresh');
                });
            </script>
        </ul>
    </div><!-- /content -->
</body>
</html>

Here is my json data ([live version] (http://dev.mycourtdates.com/jsonData.txt)):

[
   {
      "active":"1",
      "caseNumber":"B 1102907-C",
      "timeDate":"2012-07-31 09:00:00",
      "setting":"JURY TRIAL",
      "location":"H.C. COURT HOUSE ROOM 320",
      "plaintiffs":"STATE OF OHIO",
      "defendants":"EDWARD L HOGAN",
      "attorneyId":"PP68519"
   },
   {
      "active":"",
      "caseNumber":"B 1200563",
      "timeDate":"2012-08-06 09:00:00",
      "setting":"JURY TRIAL",
      "location":"H.C. COURT HOUSE ROOM 320",
      "plaintiffs":"STATE OF OHIO",
      "defendants":"RONALD SILER ",
      "attorneyId":"PP68519"
   }
]
  • 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-17T12:17:04+00:00Added an answer on June 17, 2026 at 12:17 pm

    Your <script> tag is in an invalid location.

    This jsfiddle is working:

    <div data-role="content">
        <ul id = "myList" data-role="listview" data-inset="true" data-filter="true">
        </ul>
    </div>
    

    The following Javascript should be placed in a <script> tag in your header.

    $(document).ready(function() {
        $.getJSON("http://dev.mycourtdates.com/jsonData.txt?",
                {
                    id: "73125"
                },
                function(data) {
                    var items = [];
    
                    $.each(data, function(i,ct_setting){
                        items.push('<li><a href="#">' + ct_setting.caseNumber + '</a></li');
                    });
                    console.log(items);
                    $('#myList').append(items).listview('refresh');
                });
    });
    

    Note I had to change the JSON source in the fiddle because of Access Control Header restrictions on your source above.

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

Sidebar

Related Questions

Trying to build a tree structure with knockout and jquery mobile. using a listview
I'm trying to build a jquery dropdown menu, basically I have the left navigation
I'm trying to build some jquery tabs based on the request (which is stored
I'm trying to build a jQuery sortable list that has two lists, an available,
I'm trying to build DOM with jQuery and fill it with data that is
I'm a newbie trying to learn how to build a jQuery Mobile App and
JQuery Mobile is making my cry tonight. I'm trying to build custom controls so
I'm trying to wrap my head around jQuery Mobile. My aim is to build
I'm trying to build in jQuery mobile a simple "store location" service, where in
I'm trying to build a menu for a mobile app (using jQuery Mobile). I

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.