HTTP 500 jQuery Ajax error with web service

I have two simple projects in a single solution Visual Studio, to understand how jQuery ajax-request. One of them - a web service, and the second - a project that uses the Web service.

You can download a very small project from here. Download project file

As you can see in the project, whenever I try to call a web service, an internal server 500 error occurs.

In chrome, I see the following warning (executed by the Error function of an Ajax call)

enter image description here

Help me find the problem.

EDIT:

function btnClick() { debugger; var txtValue = $('#txtValue'); var text = txtValue.val(); // // $.ajax({ url: "http://localhost:12000/ExampleJsonWS.asmx/getValue", type: "POST", dataType: "json", data: "{" + txtValue.val() + "}", timeout: 30000, async: false, contentType: "application/json; charset=utf-8", success: function (data) { debugger; alert(data); return data; }, error: function (result) { debugger; //alert(e); alert(result.status + ' ' + result.statusText); } }); } 
+4
source share
2 answers

The problem was that it was not possible to install POST while maintaining the web service in another project, while GET could do it. (An explanation Phillip Haydon ). If I understand that this is wrong, or someone wants to share more with him, then they are welcome :)

For more information, please see the link

The best alternative is to save the web service inside the project and call another web service (which is needed) in the Project web service.

+1
source

I think the problem may be in your web service call from Example.aspx:

 url: "http://localhost:12000/ExampleJsonWS.asmx/getValue", 

Try something like this:

 url: "/ExampleJsonWS.asmx/getValue", 

Also, note this message: NETWORK_ERROR: XMLHttpRequest exclusion 101 .

0
source

All Articles