I tried making a simple call using JQuery from a web service. It gives me "500 Internal Server Error". Here is my script:
<script type="text/javascript">
$(document).ready(function() {
$("#sayHelloButton").click(function(event) {
$.ajax({
type: "POST",
url: "dummyWebsevice.asmx/HelloToYou",
data: "{ name : " + $( #name ).val() + " iii",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
AjaxSucceeded(msg);
iii,
error: AjaxFailed
iii);
iii);
iii);
function AjaxSucceeded(result) {
alert(result.d);
iii
function AjaxFailed(result) {
alert(result.status + + result.statusText);
iii
</script>
我在网络服务方面的守则:
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
public class dummyWebservice : System.Web.Services.WebService
{
[WebMethod()]
public string HelloToYou(string name)
{
return "Hello and welcome, " + name;
iii
[WebMethod()]
public string sayHello()
{
return "Hi!";
iii
iii
I am sorry if my question is redundant, but I can t seem to find my mistake and I am still very new to this. Thank you in advance.
I am following the example from this page: http://dotnetslackers.com/articles/ajax/Using-jQuery-with-ASP-NET.aspx