• ajax的post提交


        <script language="javascript">
            var xmlHttpRequest = null;
            function selectionChanged() {
                // IE only.
                xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
                string = "objstr=1";
                //发送数据
                xmlHttpRequest.open("POST", "A.aspx", false);//提交到A.aspx
                xmlHttpRequest.setrequestheader("content-length", string.length);
                xmlHttpRequest.setrequestheader("content-type", "application/x-www-form-urlencoded");
                xmlHttpRequest.send(string);

                xmlHttpRequest.onreadystatechange=onReadyStateChange;
            }

            function onReadyStateChange() {
                if (xmlHttpRequest.readyState == 4) {
                    if (xmlHttpRequest.status == 200) {
                        var w= xmlHttpRequest.responseText;
                    }
                }
            }
        </script>

        protected void Page_Load(object sender, EventArgs e)
        {
            Response.ContentType = "text/plain";

            string objstr= Request.Form["objstr"].ToString();


            Response.Write("Hello World"+objstr); 

            Response.End();
        }

    另外,AJAX是不支持跨域提交的,这应该是浏览器的权限的

  • 相关阅读:
    Cefsharp支持MP4和MP3的CEF库cef.redist.x86.3.2623,对应Cefsharp49
    解读设计模式
    模拟支付宝、淘宝登录2
    模拟支付宝、淘宝登录1
    上一篇随笔是2011-11-21 17:23,唏嘘啊。。。
    像素格式
    YUV格式详解
    认识RGB和YUV
    WPF性能优化经验总结
    【日期正则表达式】
  • 原文地址:https://www.cnblogs.com/cuihongyu3503319/p/1456979.html
Copyright © 2020-2023  润新知