title: Not able to call a webmethod in a code page from master page
body: <p>I have a webmethod in c# asp.net and a jquery code to call that method. If I place code in webService page like myservice .asmx it works fine. I call it from the same master page. But when I call it from .aspx page It doesnt work at all. I am calling this webservice on button click event. Button click is fired in both situations I checked it through alert in javascript.</p>
  
  <p>MY Master page code for calling webmethod is as:</p>
  
  <pre><code> &lt;%--  WebService Data--%&gt;
    &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"&gt;&lt;/script&gt;
       &lt;script type ="text/javascript" &gt;
           $(document).ready(function () {
               $("#btni").click(function () {
                   var dataSent = "{roll:" + 1 + ",name:\"" + "Mubashir\"}"                               
                   $.ajax({    
                       type: "Post",
                       url: "EmailList.aspx/heelo",
                       data: dataSent,
                       contentType: "application/json; charset=utf-8",
                       dataType: "json",
                       success: function (response) {
                           var studentInfo = response.d;
                           alert(JSON.stringify(response.d));
                           $("#output").empty();
                           $.each(studentInfo, function (index, Info) {
                               //alert(index);
                               //alert(index.Info);
                               $("#output").append(
                                   '&lt;strong&gt;Roll : &lt;/strong&gt;' + Info.roll + ' ' +
                                    '&lt;strong&gt;Name : &lt;/strong&gt;' + Info.name + ' ' +
                                     '&lt;strong&gt;Address : &lt;/strong&gt;' + Info.address + '&lt;br/&gt; '
                                   );    
                           });  
                       },    
                       failure: function (msg) {
                           alert(msg.d);    
                           $("#output").text(msg);    
                       }   
                   });   
               });   
           });
      &lt;/script&gt;
  </code></pre>
  
  <p>&lt;%--  WebService Data--%><br/>
  webmethod on EmailList.aspx.cs page is like this:</p>
  
  <pre><code>[WebMethod]
  public string heelo(int roll, string name)
  {
  
      return "Mubashir";
  }
  //WebService
  </code></pre>
  
  <p>If I place same method on myservice.asmx code file it works fine.</p>