title: the server responded with a status of 405 (Method Not Allowed)
body: <p>I am new to Web Sevice, I am getting the following error when I tried to run my page (<strong>Local</strong>) in Chrome Console</p>
  
  <p><strong>ERROR</strong></p>
  
  <blockquote>
    <p>Failed to load resource: the server responded with a status of 405 (Method Not Allowed) <code>http://localhost:12015/myWebService.asmx?op=GetCategories</code></p>
  </blockquote>
  
  <hr>
  
  <p>Here is the related code: </p>
  
  <p><em>jQuery</em></p>
  
  <pre><code> $.ajax({
       url: "http://localhost:12015/myWebService.asmx?op=GetCategories",
       type: "POST",
       ------------
       ------------
      success: function (data) {                    
           var categories = data.d;
           $.each(categories, function (index, category) {
               category.CategoryId).text(category.CategoryName);
           });
      },
      error: function (e) {  //always executing 'error' only
           alert("hello");
      }
  </code></pre>
  
  <p><em>web service URL</em></p>
  
  <blockquote>
    <p><code>http://localhost:12015/myWebService.asmx</code></p>
  </blockquote>
  
  <hr>
  
  <pre><code> [WebMethod]
   [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
   public List&lt;Categories&gt;  GetCategories()
   {
        //code
   }
  </code></pre>
  
  <p><em>Page URL</em></p>
  
  <blockquote>
    <p><code>http://localhost:11761/Default.aspx</code></p>
  </blockquote>
  
  <p>EDIT:  The error gone when I just included <code>dataType: 'jsonp'</code> But now there is another error.</p>
  
  <blockquote>
    <p>Uncaught SyntaxError: Unexpected token &lt;<br>
    <code>:12015/myWebService.asmx?op=GetCategories&amp;callback=jQuery183010907560377381742_1356599550427&amp;{}&amp;_=1356599550438:3</code></p>
  </blockquote>
  
  <p>When I clicked the link(which was mentioned in the error), it is displaying the page. Then what could be the problem ? I dont know what the error means (and also which part of code to show). Please help.</p>
  
  <p><strong>Related</strong> </p>
  
  <p><a href="https://stackoverflow.com/q/14053484/1577396"><strong>Link1</strong></a> (explanation)<br>
  <a href="https://stackoverflow.com/a/14122895/1577396"><strong>Link2</strong></a> (solved)</p>