[英]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.