首页 新闻 会员 周边

手机开发调用ashx

0
悬赏园豆:15 [已解决问题] 解决于 2014-05-20 10:16
<!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;
            }
        }
    }
}

这是什么问题?

问题补充:

在手机上可以进入"tap"事件,但是就是进不了ajax

生活还是要继续的主页 生活还是要继续 | 初学一级 | 园豆:10
提问于:2014-05-19 19:11
< >
分享
最佳答案
0

浏览器问题,你先测试下那个接口不用ajax直接访问是否能打开.

可以打开就是浏览器兼容问题.

收获园豆:15
吴瑞祥 | 高人七级 |园豆:29449 | 2014-05-20 09:52

谢谢你!提醒!虽然不是你说的那个问题,但是给我提供思路了

是我IIS设置有误,现在可以正常访问了

生活还是要继续 | 园豆:10 (初学一级) | 2014-05-20 10:06

谢谢你!提醒!虽然不是你说的那个问题,但是给我提供思路了

是我IIS设置有误,现在可以正常访问了

是我在iis应用程池设置的非托管导致的,更改下就可以了

生活还是要继续 | 园豆:10 (初学一级) | 2014-05-20 10:09
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册