ajax html send,Use AJAX to send html5 textarea directly without html | 易学教程

问题

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值