function impart() { var result = testAjax.impart().value;
} 这个是 JS
[AjaxPro.AjaxMethod]
public CMRShop.Model.Product.productcolor impart()
{
CMRShop.BLL.Product.ProductColor bll = new CMRShop.BLL.Product.ProductColor();
CMRShop.Model.Product.productcolor model = new CMRShop.Model.Product.productcolor();
model = bll.GetModelID(1);
return model;
}这个是 JS用来调用数据的 AJAX现在问题是 AJAX 返回的是model,,我怎样把这个 model 返回给 result 呢。? 尝试了很多种办法,都不知道怎么弄? 一个实体层数据如何返回给JS变量,,真不知道该怎么办了。。请教各位大虾了 。。
解决方案 »
- 帮忙看看字符串处理的问题
- Excel 数字格式
- 关于Repeater控件中图片放大问题!
- 求正则表达式,很急!!
- 验证控件的时间范围问题,进来拿分了.
- 函数定义中out的用法
- Cookie问题~!
- 无法打开登录所请求的数据库 "GDMS"。登录失败。
- UPDATE StudentTable SET Grade = @grade, Class = @class, Birthday = @birthday where Name = @name要是放到存储过程中,SQL语句应该
- 困惑好久的问题!数据更新不了,请大家帮帮忙阿!
- 调div宽度问题 我怎么调都不行看看代码
- dropdownlist值传递问题
你最多返回 json数据
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;namespace TestJsonSerialize
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
AjaxPro.Utility.RegisterTypeForAjax(typeof(TestJsonSerialize._Default));
} [AjaxPro.AjaxMethod]
public User GetUser()
{
return new User();
}
}
public class User
{
public string username = "symbol";
}
}
[code=JScript]
<script type="text/javascript"> var f = function() { var res = TestJsonSerialize._Default.GetUser();
debugger;
alert(res.value.username);
}
</script>[/code]
public ContentResult CheckEmail(string userEmail, string email)
{
userEmail = userEmail.SqlFilter();
string resultst = string.Empty; if (string.IsNullOrEmpty(userEmail)) userEmail = email;
userEmail = userEmail.SqlFilter();
if (!string.IsNullOrEmpty(userEmail))
{
bool result = userService.CheckEmail(userEmail);
//return Json(!result);
resultst = result ? "false" : "true";
}
else
resultst = "false";
// return Json(false);
string call = HttpContext.Request.QueryString["callback"];
if (!string.IsNullOrEmpty(call))
return Content(call + "(" + resultst + ")");
else
return Content("" + resultst + "");
}{state:1,msg:'你好'}这些是json格式。
你到网上查 js 操作json