Request.HTML

Sends HTML code to backend updates target div and executes <script>

by AnthraxisBR

HTML

<table>
  <tr>
    <td>
      1
    </td>
    <td>
      2
    </td>
  </tr>
  
    <td>
      3
    </td>
    <td>
      4
    </td>
  </tr>
</table>

<div id='target'><p>This text will be replaced in 3 seconds</p></div>

CSS

body {
    font-family: Helvetica, Sans, Arial;
}
p {
    padding: 10px;
}

JavaScript

new Request.HTML({
    url: '/echo/html/',
    data: {
        html: "<p>Text echoed back to request</p>" + "<script type='text/javascript'>$('target').highlight();<\/script>",
        delay: 3
    },
    method: 'post',
    update: 'target'
}).send();