Solved

json add then remove

Posted on 2013-11-14
4
140 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Why is initialize not a function? 8 52
dynamic created check uncheck boxes 6 42
Rotate images for Web Page 11 27
Cannot exit IF statement in PowerShell 4 23
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
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 create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

749 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