Solved

json add then remove

Posted on 2013-11-14
4
132 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
This article will show, step by step, how to integrate R code into a R Sweave document
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
The viewer will learn how to count occurrences of each item in an array.

895 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now