[英]Uncaught Type Error:JavaScript
$(document).ready(function(){
$('.completecompanyDetails').click(function(){
var orgname = $("#companyName").val();
var jsonData = {};
jsonData.orgName = orgname;
$.ajax({
url: url,
data:JSON.stringify(jsonData),
type:"text",
method:"POST",
contentType:'application/json',
success: function(data){
window.location.href="/config";
return true;
},
error: function () {
alert("Error!");
return true;
}
});
});
});
我在第8行遇到以下错误:
Uncaught TypeError: Accessing selectionDirection on an input element that cannot have a selection.
type用于定义get或post方法。 type :'text'
是无效的选项。 您要在类型选项下的方法上设置值。
如果要设置要接收响应的数据类型,请使用dataType
键。 即使在dataType键中,也仅允许使用xml,json,脚本或html。
请参阅http://api.jquery.com/jQuery.ajax/中的 jquery ajax文档
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.