Clear Data Jquery When Opening Another Modal

0

I have a simple table, which by pressing a button takes that id from the row and sends a% to% co, which returns all the values for a php and it shows them to me in a pop-up window, in this case it shows me a name, the problem is that when I go open a pop-up window of another row I get the name of the previous row and the name of the window that I just opened.
It is as if the names were accumulated one by one each time I open a different pop-up window
This is the code I am using.

$("#nombre").append(answer[0].nombre);


If I use a JSON ps it does not show me the data on the screen then I would think that this method does not work for me.

    
asked by JDavid 23.01.2017 в 16:44
source

1 answer

2

That's because you're using append which is something like adding. That is why it is concatenated. You should use text :

$("#nombre").text(answer[0].nombre);
    
answered by 23.01.2017 / 16:47
source