Solved

json add then remove

Posted on 2013-11-14
4
136 Views
Last Modified: 2013-11-14
I can append data but when I keep changing it keeps adding the data along side each other. I want the first value to leave the append the new data

$("#MyList").change(function () {
         
            var Id = $("#MyList").val();

            $.ajax({
                url: '@Url.Action("name", "Home")',
                type: "Post",
                data: { CustomerStoreId: Id },
                success: function (listItems) {
                       $('#stor).append(Id).html;                   
                },

Open in new window


example
first value
1234
if new value 897 then it comes out.
1234897
0
Comment
Question by:sevensnake77
  • 2
  • 2
4 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 39648683
$('#stor).empty()

remove all elements of $('#stor')
0
 
LVL 9

Author Comment

by:sevensnake77
ID: 39648824
Ok but where in my current Json can I put that. I tried it and nothing returns.
0
 
LVL 82

Expert Comment

by:leakim971
ID: 39648834
my current Json 

Open in new window


which line?
0
 
LVL 9

Author Closing Comment

by:sevensnake77
ID: 39648841
it works thanks
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Some AHK commands fail in Microsoft OneNote 5 48
jQuery delay animation 3 29
add a 3rd selection to sum 7 27
jQuery for Each 12 18
How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question