
mvc从前台发送ajax请求得到的数据显示未定义(undefined),哪位帮忙看看 15
前台代码是这样的:varcategoryId=$(this).attr("title");vardatas=$.ajax({type:"POST",sysnc:true,...
前台代码是这样的:
var categoryId = $(this).attr("title");
var datas = $.ajax({type: "POST",sysnc: true,url: "GetDocumentByCategoryId",data: "CategoryId=" + categoryId,dataType: "json"}).responseText;alert(datas);
后台代码:
public JsonResult GetDocumentByCategoryId(int categoryId) { List<Document> documents = DocumentService.GetDocumentByCategory(categoryId); return Json(documents); }调试显示已经成功从数据库中取到数据了!但是在前台调用时显示未定义,哪位帮我看看!!! 展开
var categoryId = $(this).attr("title");
var datas = $.ajax({type: "POST",sysnc: true,url: "GetDocumentByCategoryId",data: "CategoryId=" + categoryId,dataType: "json"}).responseText;alert(datas);
后台代码:
public JsonResult GetDocumentByCategoryId(int categoryId) { List<Document> documents = DocumentService.GetDocumentByCategory(categoryId); return Json(documents); }调试显示已经成功从数据库中取到数据了!但是在前台调用时显示未定义,哪位帮我看看!!! 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询