>웹 프론트엔드 >HTML 튜토리얼 >juery 和ajaxPro结合使用的问题,如内容_html/css_WEB-ITnose

juery 和ajaxPro结合使用的问题,如内容_html/css_WEB-ITnose

WBOY
WBOY원래의
2016-06-24 11:41:341473검색

前台:
 jQuery(document).ready(function($) 
            {
                $("#div1").mouseover(function() {
                    alert('ddddddd');
                });
                $("#btnGetValue").click(function() {

                    var vUrl = $("#hUrl").val();
                    $.ajax(
                                     {
                                         type: "POST",
                                         url: vUrl,
                                         data: null,
                                         beforeSend: function(xhr) {
                                             xhr.setRequestHeader("ajaxpro-method", "HelloWorld");
                                         },
                                         success: function(s) {
                                             alert(s);

                                             var a = document.getElementById("div");
                                           a.innerHTML=  s;
                                         }

                                     });

                });
            });



    

    

        

            

      
      

    

    




后台:
 AjaxPro.Utility.RegisterTypeForAjax(typeof(Default3));
             if (!IsPostBack)
             {
                 string path = "/WebSite1/ajaxpro/Default3,";
                 path += typeof(Default3).Assembly.FullName.Split(',')[0];
                 path += ".ashx";
                 hUrl.Value = path;

             }
[AjaxPro.AjaxMethod]
 public string HelloWorld()
         {
             return "
aaaa
";
         }
上边有个div1鼠标滑过事件 这样从后台过来的滑过事件就不执行 为什么怎么才能执行 在线等


回复讨论(解决方案)

这问题到现在没有回答的 但是我用其他方法实现了 如果有能实现的人加分

这问题到现在没有回答的 但是我用其他方法实现了 如果有能实现的人加分


不是很明白楼主 在使用了 $.ajax的前提下还要使用 ajaxpro 是为什么
直接调用 Default3.HelloWorld().value 不能满足你的要求?

若要非得使用此方式 访问
  $.ajax(
                                   {

                                       type: "POST",
                                       url: vUrl,
                                       beforeSend: function (xhr) {
                                           xhr.setRequestHeader("Content-Type", "text/plain;charset=utf-8");
                                           xhr.setRequestHeader("X-" + AjaxPro.ID + "-Method", "HelloWorld");
                                           if (!MS.Browser.isIE) {
                                               xhr.setRequestHeader("Connection", "close");  // Mozilla Bug #246651
                                           }
                                       },
                                       success: function (s) {
                                    
                                           alert(eval(s + "*" + "/"));
                                         
                                       }

                                   });

            });
以上 支持 非ie 系列 ,ie系列请求楼主有兴趣的话就看 ajaxpro 中core.ashx等文件
中ajaxpro是如何构造 的 xmlhttp请求


这问题到现在没有回答的 但是我用其他方法实现了 如果有能实现的人加分


不是很明白楼主 在使用了 $.ajax的前提下还要使用 ajaxpro 是为什么
直接调用 Default3.HelloWorld().value 不能满足你的要求?

若要非得使用此方式 访问
  $.ajax(
                                   {

                                       type: "POST",
                                       url: vUrl,
                                       beforeSend: function (xhr) {
                                           xhr.setRequestHeader("Content-Type", "text/plain;charset=utf-8");
                                           xhr.setRequestHeader("X-" + AjaxPro.ID + "-Method", "HelloWorld");
                                           if (!MS.Browser.isIE) {
                                               xhr.setRequestHeader("Connection", "close");  // Mozilla Bug #246651
                                           }
                                       },
                                       success: function (s) {
                                    
                                           alert(eval(s + "*" + "/"));
                                         
                                       }

                                   });

            });
以上 支持 非ie 系列 ,ie系列请求楼主有兴趣的话就看 ajaxpro 中core.ashx等文件
中ajaxpro是如何构造 的 xmlhttp请求
我想说的是 事隔两年 我再回来看我之前的问题感觉很低级 我真的笑了
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.