Organize date received and change, jquery

1

I get two server divs like this:

 <div id="1"></div>
 <div id="2"></div>

asked by anonymous 02.01.2015 / 23:00

1 answer

1

What you can do is look inside the server for the elements and iterate to remove the ID. I think it will work even though IDs have to be unique.

But the best thing was for the server to return a JSON with for example:

'{ "umaID": "html", "outraID": "html, etc...'

But using what you have and what is in the question, try this:

$.ajax({
    url:"teste.php",  
    success:function(data) {
        $(data).find('*').each(function(){
            $('#' + this.id).html(this.innerHTML);
        }); 
    }
});
    
02.01.2015 / 23:42