the server responded with a status of 405 (Method Not Allowed)
try this
[WebMethod]
[ScriptMethod(UseHttpPost = true)]
public List<Categories> GetCategories()
{
//code
}
or edit web.config
<system.web>
...
<webServices>
<protocols>
<add name="HttpSoap"/>
<add name="HttpPost"/> -->
<add name="HttpGet"/>
<add name="Documentation"/>
<add name="HttpPostLocalhost"/>
</protocols>
</webServices>
...
</system.web>
Refer http://codeclimber.net.nz/archive/2006/12/22/How-to-enable-an-ASP.NET-WebService-to-listen-to-HTTP.aspx
make your content type as "application/json; charset=utf-8", as follows
$(document).ready(function() {
$.ajax({
type: "POST",
url: "RSSReader.asmx/GetRSSReader",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
// Hide the fake progress indicator graphic.
$('#RSSContent').removeClass('loading');
// Insert the returned HTML into the <div>.
$('#RSSContent').html(msg.d);
}
});
});
also refer link
I added a simple line on my friend's suggestion above the jquery ajax call
jQuery.support.cors = true;
Now it is working fine :)
ONLY IN IE BROWSER
I would be happy to know if it can be solved using different way as it is not recommended.
Anyhow I asked this question again after many efforts and I got different error which was solved in this post here