Solved

json add then remove

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

760 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

21 Experts available now in Live!

Get 1:1 Help Now