Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

json add then remove

Posted on 2013-11-14
4
Medium Priority
?
156 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:Seven price
  • 2
  • 2
4 Comments
 
LVL 82

Accepted Solution

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

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

Author Comment

by:Seven price
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:Seven price
ID: 39648841
it works thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
This article discusses how to create an extensible mechanism for linked drop downs.
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 seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses

971 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