我尝试了一切来自
var data = $('#editme').val();
var data = $('#editme').value();
var data = $('#editme').html;
var data = $('#editme').val;
没有任何效果。
这是我的剧本:
<script type="text/javascript">
$(document).ready(function() {
$("#p1").click(function(e) {
e.preventDefault();
console.log('select_link clicked');
var data = $('#editme').val();
console.log(data);
$.ajax({
type: 'POST',
data: JSON.stringify(data),
contentType: 'application/json',
url: 'http://localhost:3000/Upload/newQuestion',
success: function(data) {
console.log('success');
console.log(JSON.stringify(data));
}
});
});
});
</script>
这也是文字区域:
<textarea id="editme" name= "editme" class="form-control" rows="4" cols="50" placeholder="Post question."spellcheck="true" ></textarea>