在caling服务时在MVC中使用ajax时收到错误消息 [英] getting error message while using ajax in MVC while caling service
问题描述
这是我的观点
< script type = text / javascript>
$( function (){
var data1 = [ ];
var dist = {
MemberID: 389104 ,
年份: 2015 ,
OwnerLastName:' abcd '
};
data1.push(' WEBNet' );
data1.push(' FindPerson');
data1.push(dist);
$ .ajax({
type: POST ,
contentType: application / json; charset = utf-8 ,
url:' Service.svc / GetData',
data: JSON .stringify(data1),
成功:< span class =code-keyword> function (data){
},
error: function (结果){
alert(result);
}
});
});
< / script>
我有一项服务 - Service.svc / GetData返回个人详细信息
当我用Internet Explorer打开视图时它给我以下错误消息
[对象]
有人可以告诉我问题出在哪里
( function (){
var data1 = [];
var dist = {
MemberID: 389104 ,
年份: 2015 ,
OwnerLastName:' abcd'
};
data1.push(' WEBNet');
data1.push(' 是FindPerson'跨度>);
data1.push(dist);
.ajax({
type: POST,
contentType: application / json; charset = utf-8,
url:' Service.svc / GetData',
数据: JSON .stringify(data1),
成功:功能 (数据){
},
错误: function (结果){
alert(结果) );
}
});
});
< / script>
我有一项服务 - Service.svc / GetData返回个人详细信息
当我用Internet Explorer打开视图时它给我以下错误消息
[对象]
有人可以告诉我问题在哪里
正如Afzaal Ahmad告诉[对象对象]是不是错误。 [object object]基本上是一个数组。
你可以得到回复
here is my view
<script type="text/javascript">
$(function () {
var data1 = [];
var dist = {
MemberID: 389104,
Year: 2015,
OwnerLastName: 'abcd'
};
data1.push('WEBNet');
data1.push('FindPerson');
data1.push(dist);
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: 'Service.svc/GetData',
data: JSON.stringify(data1),
success: function (data) {
},
error: function (result) {
alert(result);
}
});
});
</script>
and i have a service - Service.svc/GetData which returns the person details
when i open the view with internet explorer it is giving me the below error message
[object Object]
Can some one plz tell me where the issue is
(function () { var data1 = []; var dist = { MemberID: 389104, Year: 2015, OwnerLastName: 'abcd' }; data1.push('WEBNet'); data1.push('FindPerson'); data1.push(dist);
.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: 'Service.svc/GetData', data: JSON.stringify(data1), success: function (data) { }, error: function (result) { alert(result); } }); }); </script>
and i have a service - Service.svc/GetData which returns the person details
when i open the view with internet explorer it is giving me the below error message
[object Object]
Can some one plz tell me where the issue is
As Afzaal Ahmad told [object object] is not a error. [object object] is a basically a array.
you can get the response
这篇关于在caling服务时在MVC中使用ajax时收到错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!