我正在使用ajax调用从主域调用子域控制器方法,如下所示
type TypeDesc int
const (
typeInt TypeDesc = iota
typeHttpRequest
typeOsFile
typeInt64
)
func printType(t TypeDesc) {
switch t {
case typeInt:
fmt.Println("Type: int")
case typeHttpRequest:
fmt.Println("Type: http.request")
case typeOsFile:
fmt.Println("Type: os.file")
case typeInt64:
fmt.Println("Type: uint64")
default:
fmt.Println("Type: Other")
}
}
func main() {
printType(typeInt)
printType(typeHttpRequest)
printType(typeOsFile)
printType(typeInt64)
}
我的响应为200(状态正常)以及我得到的json数据如下
$.ajax({
type: "POST",
url: "https://demo.trufin.in/getBorrowerType",
cache: false,
dataType: "json",
success: function(response) {
//success part
},
error:function(error){
//error part
}
});
但问题是ajax返回错误!!
尝试所有可能的解决方案,如
[{
"borrowerTypeName": "Co-operative Member",
"addedDate": "2016-10-04",
"borrowerTypeId": 1,
"addedBy": "23646",
"isActive": 1
}, {
"borrowerTypeName": "Bank Account Holder",
"addedDate": "2016-10-04",
"borrowerTypeId": 2,
"addedBy": "23646",
"isActive": 1
}, {
"borrowerTypeName": "Others",
"addedDate": "2016-10-04",
"borrowerTypeId": 3,
"addedBy": "23646",
"isActive": 1
}]
但没效果。
答案 0 :(得分:-1)
为了保持一致性,请尝试将数字包装在引号中。