<!DOCTYPE html> <html > <head> <title>微网站</title> <meta name="viewport" content="height = device-height,width=device-width,initial-scale = 1.0,user-scalable=true" /> <!--<meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1"></meta>--> <link href="css/jquerymobile/jquery.mobile-1.4.2.css" rel="stylesheet" type="text/css" /> <link href="css/public.css" rel="stylesheet" type="text/css" /> <link href="css/mobile.css" rel="stylesheet" type="text/css" /> <script src="js/jquery.js" type="text/javascript"></script> <script src="js/jquery.mobile-1.4.2.js" type="text/javascript"></script> <script src="js/jQuery.ui.datepicker.js" type="text/javascript"></script> <script src="js/jquery-date-tool.js" type="text/javascript"></script> <script type="text/javascript"> $(document).bind("mobileinit", function () { $.mobile.page.prototype.options.degradeInputs.date = true; }); $(function () { $("#form_submit_btn").bind("tap", function () { $.ajax({ url: "service/helper.ashx", dataType: "json", Type: "POST", success: function (o) { alert(o.Result); } }); }) $("#Button1").click(function () { $.ajax({ url: "/service/helper.ashx", dataType: "json", Type: "POST", success: function (o) { alert(o.Result); } }); }); }) </script> </head> <body> <div data-role="page"> <div data-role="header"> <h1>Page Title</h1> </div> <div class="content" data-role="content"> <div><img style=" width:100%" src="images/img1.png" /></div> <div><img style=" width:100%" src="images/img1.png" /></div> <div><img style=" width:100%" src="images/img1.png" /></div> <form method="post" > <div class="online" data-row="fieldcontain"> <h4>在线报名</h4> <span>报名时间</span> <input type="date" id="time" style=" height:30px;" /> <div id="priceLabel">学习费用</div> <div class="select-ticket-contant" > <button class="btn select-ticket" data-inline="true" data-tickttype="清华学员4800" type="button">清华学员(4800)</button> <button class="btn select-ticket" data-inline="true" data-tickttype="非清华学员5800" type="button" >非清华学员(5800)</button> </div> <div >已选</div> <div class="selected-ticket-contant"> </div> <input type="text" style=" height:40px;" id="text1" placeholder="联系人" data-clear-btn="true" /> <input type="text" style=" height:40px;" id="text2" placeholder="联系电话" data-clear-btn="true" /> <input type="text" style=" height:40px;" id="text3" placeholder="邮箱" data-clear-btn="true"/> <input type="text" style=" height:40px;" id="text4" placeholder="公司" data-clear-btn="true"/> <input type="text" style=" height:40px;" id="text5" placeholder="职位" data-clear-btn="true" /> <button data-role="none" class="btn ticket-submit-btn" type="button" id="form_submit_btn" data-activity="580" data-success-msg="您的信息已提交成功!" >立即报名</button> </div> </form> </div> <div data-role="footer"> <h4>Page Footer</h4> <button class="btn ticket-submit-btn" type="button" id="Button1" >立即报名</button> </div> </div> </body> </html>
红色部份在PC机上可以正常运行,但是在手机上就没有反应
下面的是.ashx文件
using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace Mobile.service { /// <summary> /// helper 的摘要说明 /// </summary> public class helper : IHttpHandler { public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.Write("{\"Result\":\"Hello World\"}"); //context.Response.Write("Hello World"); } public bool IsReusable { get { return false; } } } }
这是什么问题?
浏览器问题,你先测试下那个接口不用ajax直接访问是否能打开.
可以打开就是浏览器兼容问题.
谢谢你!提醒!虽然不是你说的那个问题,但是给我提供思路了
是我IIS设置有误,现在可以正常访问了
谢谢你!提醒!虽然不是你说的那个问题,但是给我提供思路了
是我IIS设置有误,现在可以正常访问了
是我在iis应用程池设置的非托管导致的,更改下就可以了