先说下需求:在原来的WebApi项目中增加对js跨域的请求支持,请求方式:以POST为主,webapi路由规则根据原项目需求修改如下: public static void Register(HttpConfiguration config) { // Web API configuration and services // Web API routes config.MapHttpAttributeRoutes(); config.Routes.MapHttpRoute( name: "De
// 获取url中的参数,并返回一个对象 $.getRequestData = function() { var url = location.search; //获取url中"?"符后的字串 var theRequest = {}; if (url.indexOf("?") != -1) { var str = url.substr(1); strs = str.split("&"); for (var i = 0; i < st
不是原创,只是 借鉴别人的成果,我在此纪念 1.htm function GetDateT() { var d,s; d = new Date(); s = d.getFullYear() + "-"; //取年份 s = s + (d.getMonth() + 1) + "-";//取月份 s += d.getDate() + " "; //取日期 s += d.getHours() + ":"; //取小时 s += d.
url中的内容www.XXXX.com?content=123; 一下为js内容,包装在一个init方法中. init(); function init(){ var theRequest = new Object(); var url = location.search; ) { ); strs = str.split("&"); ; i < strs.length; i ++) { theRequest[strs[i].split(]]=(strs[i].split(
#index.html window.location.href = "../home.html?value=" + rec_value; #home.html <script> var a = GetRequest(); console.log(a); function GetRequest() { var url = location.search; //获取url中"?"符后的字串 var theRequest = new Object(); if