Sandbox

My Sandbox for testing.

by cawoodm

HTML

Name: <input id="q"/>
<input id="b" type="button" value="Say Hello!"/>
    
<div id="results"><h1>Hellos</h1></div>

CSS

* {font-family: georgia}
h1 {
    font-size: 14pt;
    font-weight: bold;
}

JavaScript

$(function() {
    $('#b').click(function() {
        doAjax($('#q').val());
    });
});

function doAjax(q) {
 $.ajax({
  type: "POST",
  url: '/echo/html/',
  data: {
      html: 'Hello ' + q
  },
  success: function(text) {
   $('#results').append('<div>' + text + '!</div>');
  },
  error: function(e) {
   console.log(e);
  }
 });

}