Handle data returned from ajax request with JQuery

3

My request:

 $.post(
      "http://painel.thomerson.com.br/imagens/escolher-template",
      $(this).serialize(),
      function(data){
            $("#Resultado").html(data);
      }
 );

What is happening is that by inserting the contents of the variable data to div #Resultado , the full html code of the page itself is being inserted, I would like to know if there is any way to return another type of data.

Screen before the Ajax request:

ScreenaftertheAjaxrequest:

There was duplication of the entire script: /

I saw some examples that returned data in JSON , bringing only what is necessary for manipulation, but I could not quite understand how it was done, I hope it was clear, otherwise, comment and I'll edit whatever it takes. p>     

asked by anonymous 26.01.2015 / 23:13

1 answer

3

If you are making the same request as the page you are in, ajax when you complete and return the data it will return all content on the same screen, causing the contents of your page to duplicate

    
27.01.2015 / 14:39