我的网络服务有问题。当我以 POST 和 JSON 格式传递参数时,它返回一个 JSON 对象。我想将 POST 转换为 GET,但问题是,Web 服务仅以 XML 格式返回。
<script>
$.ajax({
type: "GET",
url: "/web_services/webservice.asmx/getReturnJson",
data: "params1=1",
contentType: "application/*; charset=utf-8",
dataType: "json")
</script>
网络服务:
[WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat=ResponseFormat.Json)]
public List<tempStruct> getReturnJson(String params1)
{
return temp;
}