2016-12-30 6 views
1

私はこの迷惑なエラーがJavaScript関数klm()を指し続けているので、エラーが出る理由は絶対にわかりません。私は私の開始タグと終了タグをチェックして、すべてがうまく見えるように見えます。私は何が間違っていますか?このエラーは、具体的にはklmメソッドを指しています。

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Dtata.aspx.cs" Inherits="Dtata" %> 

<!DOCTYPE html> 

<html xmlns="http://www.w3.org/1999/xhtml"> 
<head runat="server"> 
    <title></title> 
     <script type="text/javascript"> 
      function klm() { 
       $.ajax({ 
        type: "POST", 
        url: "Dtata.aspx/Hello", 
        contentType: "application/json; charset=utf-8", 
        dataType: "json", 
        data: { name: 'hello' }, 
        success: function (result) { 
         response(result.d); 
         Counter() 
        }, 
        error: function (result) { 
         alert('There is a problem processing your request'); 
        } 
       }); 
      } 


      function Counter() { 
       $.ajax({ 
        type: "POST", 
        url: "Dtata.aspx/Counter", 
        contentType: "application/json; charset=utf-8", 
        dataType: "json", 

        success: function (result) { 
         console.log(result.d); 
        }, 
        error: function (result) { 
         alert('There is a problem processing your request'); 
        } 
       }); 
      } 

      </script> 

</head> 
<body> 
    <form id="form1" runat="server"> 
    <input id="btnGetTime" type="button" value="Show Current Time" onclick = "klm()" /> 
    <div> 
    </div> 



    </form> 


</body> 
</html> 
+0

htmlページにjQueryのインポートが表示されません。

+0

jQueryをインクルードする必要があります。また、エラーがklm関数を指している理由は、読み込み時にklm関数に最初に当たっているためです。 – DibsyJr

答えて

1

jQueryを含める必要があります。あなたのスクリプトはjQuery関数($.ajax())を使用しています。http://jquery.com/

関連する問題