私は、AJAX呼び出しを自分のWebサービスを呼び出すようにしようと思いますが、私は、コードの下に見つけてください、それを使用してWebサービスを呼び出すために成功を得るわけではないJSONシリアライズ
私はusing System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Script.Services;
using System.Collections.Generic;
/// <summary>
/// Summary description for Jasonexample
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ScriptService]
public class Jasonexample : System.Web.Services.WebService {
public Jasonexample() {
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public string HelloWorld(Dictionary<string,object>Input) {
return "Hello World " + Input["FName"].ToString() + " " + Input["LName"].ToString();
}
[WebMethod]
public string test ()
{
return "test";
}
}
を呼び出すようにしようとしています
Webメソッド
/// <reference path="jquery-1.2.3.min.js" />
$(document).ready(function() {
dict = new Object();
dict["FName"] = "Abhishek";
dict["LName"] = "Hingu";
$.ajax({
type: "POST",
url: "Jasonexample.asmx/HelloWorld",
data: '[{"Key":"FName","Value":"Abhi"},{"Key":"LName","Value":"Hingu"}]',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
alert("Hello");
alert(msg);
},
fail:function(msg)
{
alert("fail");
}
});
});
今すぐいずれかは、あなたがどのように私に言うことができるjavascriptの私のAJAX呼び出しは、呼び出されたAJAXでの辞書のコレクションを渡すために