1
我试图用jQuery.AjaxRequest方法发布与脚本#数据:要生成ScriptSharp - 后数据为名称 - 值集合
jQueryAjaxOptions options = new jQueryAjaxOptions();
options.Url = "/Server/Login.ashx";
options.Data = new LoginRequest(username, password);
jQuery.AjaxRequest<LoginResponse>(options);
我怎样才能避免LoginRequest类? 我可以将数据作为某种名称 - 值集合传递吗? 或者使LoginRequest“导入”?
谢谢。
它为我工作,谢谢!我只需要对LoginRequest进行修改就不需要构造函数:LoginRequest data = new LoginRequest(); data.Username =用户名; data.Password =密码; – dennis
太棒了 - 希望你喜欢Script# - 我们真的觉得它在我工作的地方很有用。 – jamauss
你可以添加一个ctor,它带有一个params对象[] nameValuePairs以及一个无参数的对象...这将允许您传入“username”,用户名,“password”,密码以获得紧凑对象文字:{username:username ,密码:密码} ...希望有所帮助。 –