I'm new to Web Sevice, I get the following error when trying to launch my page ( Local ) in the Chrome console
ERROR
Failed to load the resource: the server responded with a status of 405 (method not allowed) http://localhost:12015/myWebService.asmx?op=GetCategories
Here is the related code:
JQuery
$.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) {
Web service url
http://localhost:12015/myWebService.asmx
[WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public List<Categories> GetCategories() {
Page URL
http://localhost:11761/Default.aspx
EDIT: The error dataType: 'jsonp' away when I just turned on dataType: 'jsonp' But now there is another error.
Untrained SyntaxError: Unexpected Token <
:12015/myWebService.asmx?op=GetCategories&callback=jQuery183010907560377381742_1356599550427&{}&_=1356599550438:3
When I clicked the link (which was mentioned in the error), it displays the page. Then what is the problem? I do not know what the error means (as well as what part of the code to display). Please, help.
Connected
Link1 (explanation)
Link2 ( SOLVED )
source share