JQquery在Visual Studio 2010中工作,而在VS2003中不工作 [英] JQquery works in Visual Studio 2010 and not in VS2003

查看:76
本文介绍了JQquery在Visual Studio 2010中工作,而在VS2003中不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我的Default.aspx页面上有JQuery代码:

Hi everyone,

I have JQuery code on my Default.aspx page :

<script src="js/jquery-1.4.1.min.js" type="text/javascript"></script>
  <script type="text/javascript">

       $(document).ajaxError(function(){
           if (window.console && window.console.error) {
               console.error(arguments);
           }
       });

       $(document).ready(function () {

           var msgbox = $("#status");

           $("#Button1").click(function () {

               $.ajax({

                   type: "POST",
                   //Page Name (in which the method should be called) and method name
                   url: "Default.aspx/GetDateVal",
                   // If you want to pass parameter or data to server side function you can try line
                   //data: "{'args':'Pankaj'}",
                   //else If you don't want to pass any value to server side function leave
                   data: "{}",
                   contentType: "application/json; charset=utf-8",
                   dataType: "json",
                   success: function (msg) {
                       //Got the response from server and render to the client
                       msgbox.html(msg.d);

                   }

               });

           });

       });

</script>



我在代码隐藏类中有以下代码:



I have the below code in code-behind class:

[System.Web.Services.WebMethod]
        public static string GetDateVal()
        {
            return DateTime.Now.ToString("dd/MMM/yyyy HH:mm:ss");

            //return "<input id='test1' value='wsf' />";
        }



从VS2010在本地主机上运行时,这工作得很好.返回预期的日期字符串,但是从VS2003在localhost中运行时,该方法没有返回结果吗?

有人知道为什么会这样吗?

谢谢.



This works quite fine when running in localhost from VS2010 ie. returns date string as expected but when running in localhost from VS2003 I get no result back from the method?

Anyone know why this would be so?

Thanks.

推荐答案

(文档).ajaxError(函数(){ 如果(窗口.控制台&& ; 窗口.控制台 .error){ 控制台 .error(arguments); } });
(document).ajaxError(function(){ if (window.console && window.console.error) { console.error(arguments); } });


(文档).ready( function ( ){ var msgbox =
(document).ready(function () { var msgbox =


(" );


这篇关于JQquery在Visual Studio 2010中工作,而在VS2003中不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆