昆明恐怖事件图片,综艺大热门,江湖再见 胡彦斌
一、原生方式:
1.post(以ajax请求为案例,教大家用法)
$.ajax({ type: "post", datatype: "json", cache: false, data: { method: "add" }, url: "../demo/post", async: true, success: function (data) { if (data.isok) { alert("成功"); } else { alert(“失败”); } } });
iformcollection form = httpcontext.request.form; string method = form["method"];
2.get(url传参为案例,教大家用法)
127.0.0.1/index/demo/get?num=1
iquerycollection queryparameters = httpcontext.request.query; string num = queryparameters["num"];
二、以对象的形式接收参数(get/post通用):
public class pagemodel { public string titlename { get; set; }//筛选标题 public int currentpage { get; set; }//当前页 public int numcount { get; set; } //每页数量 public long id { get; set; } = 0;//默认id public string token { get; set; } = "";//认证授权 }
public iactionresult userlist(pagemodel pagemodel) { return view(pagemodel); }
三、路由实现传参(get/post通用):
127.0.0.1/index/menudelasync/1
public async task<string> menudelasync(long id) { string jsonresult = "[]"; bool b = false; b = await articleservice.delarticletypeasync(id); if (b) jsonresult = commonhelper.newgetjsonresult(1, "删除成功"); else jsonresult = commonhelper.newgetjsonresult(-1, "删除失败"); return jsonresult; }
其它用法欢迎留言补充,谢谢!
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Blazor server side 自家的一些开源的, 实用型项目的进度之 CEF客户端
.NET IoC模式依赖反转(DIP)、控制反转(Ioc)、依赖注入(DI)
vue+.netcore可支持业务代码扩展的开发框架 VOL.Vue 2.0版本发布
网友评论