本文共 1249 字,大约阅读时间需要 4 分钟。
问题
Recently I am confused about whether it's possible to send input/textarea data directly without being included in html < form >. I thought in web page, if we want to get information from user then send the text to authentication server, we must use < form > irrespective of in which way it's submitted.
But an anonymous reviewer of my paper claims that < html > can be bypassed by using an html5 tag "textarea" and JS AJAX post. While I did lots of experiments trying to implement his way but all failed.
I wonder if there is really some way to submit user info without using < form > tag?
Thank you
----------------------------------------------------------------------------------------------------------
Thanks for everyone's reply.
Update: I followed "the_void"'s code and changed the url of AJAX to a ServerSocket (implemented by Java). The server was able to get the POST event, but it cannot read the "data" of AJAX. The following is the html code:
HTML
$(document).ready(function() {
$('#submit').click(function() {
//information to be sent to the server
info = $('#foo').val();
$.ajax({
type: "POST",
url: 'http://10.0.0.3:8888',
data: ({foo: info}),
//crossDomain: true,
//dataType: 'json'
});
return false;
});
});
Text
Submit via Ajax
转载地址:https://blog.csdn.net/weixin_34518190/article/details/117973959 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!