diff --git a/js/ch.zodiac.js b/js/ch.zodiac.js index 39908f6..d404159 100644 --- a/js/ch.zodiac.js +++ b/js/ch.zodiac.js @@ -568,7 +568,15 @@ var month = $("#month").val(); var day = $("#day").val(); /*发现api文件直接跳转的,无法获取json,改为直接跳转接口。2020-5-9 zp*/ - location.href="/travelguide/chinese-zodiac/date/api.asp?ac=ZodiacSearch"+"&searchname="+searchname+"&year="+year+"&month="+month+"&day="+day; + var params = { + 'ac':'ZodiacSearch', + 'searchname':searchname, + 'year':year, + 'month':month, + 'day':day + }; + Post("/travelguide/chinese-zodiac/date/api.asp",params); + /* $.post( "/travelguide/chinese-zodiac/date/api.asp", @@ -609,6 +617,30 @@ $(function () { CH.Zodiac.Fun.init(); }); + + /* + *功能: 模拟form表单的提交 + *参数: URL 跳转地址 PARAMTERS 参数 + */ + function Post(URL, PARAMTERS) { + //创建form表单 + var temp_form = document.createElement("form"); + temp_form.action = URL; + //如需打开新窗口,form的target属性要设置为'_blank' + temp_form.target = "_self"; + temp_form.method = "post"; + temp_form.style.display = "none"; + //添加参数 + for (var item in PARAMTERS) { + var opt = document.createElement("textarea"); + opt.name = item; + opt.value = PARAMTERS[item]; + temp_form.appendChild(opt); + } + document.body.appendChild(temp_form); + //提交数据 + temp_form.submit(); + } })();