嘿伙计们我对ajax PUT有一个愚蠢的问题,在我尝试将json数据放回服务器后认为它的xml数据即使我使用:dataType:" application / json",任何想法为什么这个他可能会这样吗?这就是我的PUT的样子:
$.ajax({
type: "PUT",
url: bank_url,
dataType: "application/json",
data: {"banking_detail_id": page.viewModel.payer_banking_detail_id(),
"person_id": person_id, "account_number": page.viewModel.payer_account_number(),
"branch": page.viewModel.payer_branch(), "date_inserted": page.viewModel.payer_date_insterted(),
"date_effective": page.viewModel.payer_date_effective(), "account_type": page.viewModel.payer_account_type(),
"account_holder": page.viewModel.payer_account_holder() , "debit_day": page.viewModel.payer_debit_day() ,
"branch_code": page.viewModel.payer_branch_code() , "bank_branch_id": page.viewModel.payer_bank_branch_id(),
"branch_name": page.viewModel.payer_branch_name(), "bank_name": page.viewModel.payer_bank_name(),
"user_id": page.viewModel.payer_user_id()},
});
服务器响应如下:
xhr = {"长度":847,"名称":"错误""严重性":" ERROR"&# 34;代码":" 23502""细节":"未按 row包含(null,1081563,12341234,ABSA ELECTRONIC SETTLEMENT CNT (632005),2013-05-05 00:00:00,2013-05-06,0,Coetzee M A,1,null, 0)。","其中":" SQL语句\" INSERT INTO banking_detail( \ n \ t \ t \ t \ ttankking_detail_id,\ n \ t \ t \ t \ t \ ttperson_id, \ n \ t \ t \ t \ t \ taccount_number,\ n \ t \ t \ t \ t分支,\ n \ t \ t \ t \ t \ tdate_inserted, \ n \ t \ t \ t \ tdate_effective,\ n \ t \ t \ t \ t \ taccount_type, \ n \ t \ t \ t \ taccount_holder,\ n \ t \ t \ t \ t \ tdebit_day, \ n \ t \ t \ t \ ttank_branch_id,\ n \ t \ t \ t \ t \ tuser_id)\ n \ t \ t \ tVALUES( \ n \吨\吨\吨\ tnew.banking_detail_id,\ n \吨\吨\吨\ tnew.person_id,\ n \吨\吨\吨\ tnew.account_number,\ n \吨\吨\吨\ TNEW。分支,\ n \吨\吨\吨\ tnew.date_inserted,\ n \吨\吨\吨\ tnew.date_effective,\ n \吨\吨\吨\ tnew.account_type,\ n \吨\吨\吨\ tnew.account_holder,\ n \吨\吨\吨\ tnew.debit_day,\ n \吨\吨\吨\ tnew.bank_branch_id,\ n \吨\吨\吨\ tnew.user_id)\" \ NPL / pgSQL的 函数banking_detail_view_set()在SQL的第4行 语句""文件":" execMain.c""线":" 1527""程序&#34 ;:" ExecConstraints"}
答案 0 :(得分:1)
请求类型是GET或POST 例如:
type: "GET",
type: "POST",
和dataType是xml,json,script或html 例如:
dataType:'html',
dataType:'xml',
dataType:'json',
dataType:'script',