JSFiddle - React, Tailwind, and code Playground

by horhey

HTML

<div id="html"></div>
<div id="form">
    <form id='myform'>
        <input id='userid' placeholder='userid'/>
        <input id='password' placeholder='password'/>
    </form>
</div>

<button id="html-load">Load HTML</button>
<div id="msg"></div>

JavaScript

$(function () {

  

    $('#html-load').click(function () {

        var userId = $('#userid').val();
        var password = $('#password').val();
        
        console.log(userId);
         console.log(password);
        $.ajax({
            url: '/echo/html/',
            dataType: 'html',
            type: 'POST',
            data: {
                html: '<img src="http://cdn.dashburst.com/wp-content/uploads/2013/01/Grumpy-Cat.jpg" alt="grumpy cat" /><p>Welcome ' + userId + '</p>'
            }
        }).done(function (html) {

            $('#msg').append(html);

        });

    });

  
    
});