Heim >Web-Frontend >HTML-Tutorial >juery 和ajaxPro结合使用的问题,如内容_html/css_WEB-ITnose

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

WBOY
WBOYOriginal
2016-06-24 11:41:341473Durchsuche

前台:
 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请求
我想说的是 事隔两年 我再回来看我之前的问题感觉很低级 我真的笑了
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn