JSFiddle - React, Tailwind, and code Playground
HTML
<form id="myform">
<table><tr>
<td valign=top>Nieuwsbrief:</td>
<td>
<select id="NieuwsbriefSelect" name="show">
<option size =30 selected>Select</option>
<option value="test">test</option>
<option value="test2">test2</option>
<option value="alles weer testen">alles weer testen</option>
<option value="testje">testje</option>
<option value="Statusupdate week 6">Statusupdate week 6</option>
</select>
</td>
</tr><tr><td>
Bericht:</td><td align="left"><textarea name="content" cols="50" rows="15"></textarea></td></tr>
</table>
</form>
JavaScript
var request;
$(document).ready(function() {
$('#NieuwsbriefSelect').change(function() {
//send Ajax call to get new contents
var selected_text = $(this).val();
// setup some local variables
var $form = $("#myform");
// let's select and cache all the fields
var $inputs = $form.find("input, select, button, textarea");
// serialize the data in the form
var serializedData = $form.serialize();
alert(serializedData);
// fire off the request to /get_my_contents.php
var request = $.ajax({
url: "/get_my_contents.php",
type: "post",
data: serializedData
});
// callback handler that will be called on success
request.done(function (response, textStatus, jqXHR){
//populate the TextArea
$("textarea[name='content']").html(response);
});
});
});