H
H
hardwellZero2015-05-22 08:25:02
JavaScript
hardwellZero, 2015-05-22 08:25:02

How to pass html class using ajax?

Good afternoon.
There is a button to which the following script is attached:

$(document).ready(function()
{
  $('.user_type_btn').click(function (e) {
    alert("button "+$(this).val());

    var data = {"user_type" : $(this).val()}
    $.ajax({
      url: '/get-user-type-roundtable',
      data: JSON.stringify(data),
      contentType: 'application/json;charset=UTF-8',
      type: 'POST',
      success: function(response) {
        console.log(response);
        round_table_html = document.getElementById("round_table");
        round_table_html.innerHTML = response
      },
      error: function(error) {
        console.log(error);
        alert(error);
      }
    });
  });
});

When you click on the button, all data is transferred as needed, but there is no layout.
Layout schemes before:
301c8499f93c4251b7faf820ef05ea84.png

and after the click:
fa964371226d43199d535dc6696506e0.png
How can you pass values ​​in such a way that the layout is preserved?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question