Rumah > hujung hadapan web > html tutorial > juery 和ajaxPro结合使用的问题,如内容_html/css_WEB-ITnose

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

WBOY
Lepaskan: 2016-06-24 11:41:34
asal
1472 orang telah melayarinya

前台:
 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请求
我想说的是 事隔两年 我再回来看我之前的问题感觉很低级 我真的笑了
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan