如何通过单击链接而不是提交按钮来发出 AJAX 请求?
我希望一旦单击链接即可从输入字段发布数据
$('selector').click(function(e){
e.preventDefault();
$.ajax({
url: "<where to post>",
type: "POST",//type of posting the data
data: <what to post>,
success: function (data) {
//what to do in success
},
error: function(xhr, ajaxOptions, thrownError){
//what to do in error
},
timeout : 15000//timeout of the ajax call
});
});
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)