CS:
[AjaxPro.AjaxMethod]
public string Delete(string strID)
{
string ids = strID;//Request["ids"];
bool IsOK = noticeBLL.DeleteList(ids);
if (IsOK)
{
return "1";
}
else
{
return "0";
}
}
JS:
<script language = "javascript" type = "text/javascript">
function delObj()
{
var ids = document.getElementsByName("ids");
var flag = false;
var strID = "";
for (var i = 0; i < ids.length; i++) {
if (ids[i].checked) {
flag = true;
strID = strID + "," + ids[i].value;
}
}
if (!flag) {
alert("请最少选择一项!");
return false;
}
flag = confirm('您确认要删除吗?删除后将无法恢复!');
if (flag) {
var o = YM.Web.SystemInfo.NoticeList.Delete(strID);
alert(o);
}
}
</script>经过调试在CS端返回的是"1"
但是执行到JS端却返回[object Object]我在网上已经找过,但是没有找到解决的方案,请指点
[AjaxPro.AjaxMethod]
public string Delete(string strID)
{
string ids = strID;//Request["ids"];
bool IsOK = noticeBLL.DeleteList(ids);
if (IsOK)
{
return "1";
}
else
{
return "0";
}
}
JS:
<script language = "javascript" type = "text/javascript">
function delObj()
{
var ids = document.getElementsByName("ids");
var flag = false;
var strID = "";
for (var i = 0; i < ids.length; i++) {
if (ids[i].checked) {
flag = true;
strID = strID + "," + ids[i].value;
}
}
if (!flag) {
alert("请最少选择一项!");
return false;
}
flag = confirm('您确认要删除吗?删除后将无法恢复!');
if (flag) {
var o = YM.Web.SystemInfo.NoticeList.Delete(strID);
alert(o);
}
}
</script>经过调试在CS端返回的是"1"
但是执行到JS端却返回[object Object]我在网上已经找过,但是没有找到解决的方案,请指点
var o = YM.Web.SystemInfo.NoticeList.Delete(strID);
alert(o[0]);
试试,不太确定,注意[0]中是零
我估计应该是:
o.d才是对的,很多的时候,ajax返回的内容是json,然后键位是d