问题描述
<scripttype="text/javascript">$(document).ready(function(){htmlobj=$.ajax({type:"POST",url:"encodRSA.php",datatype:"xml",data:{data_content:$.trim($("#data_content_D").val()),terminal_id:$("#terminal_id").val(),member_id:$("#member_id").val(),data_type:$("#data_type").val()},success:function(data){$("#data_content").html(decodeURI(data));},error:function(){alert("异常");}});});这部分怎么转成C#后台代码?谢谢各位大大
解决方案
解决方案二:
$.post("encodRSA.ashx",{terminal_id:$("#terminal_id").val(),member_id:$("#member_id").val(),data_type:$("#data_type").val()},function(result){});
解决方案三:
msdn:https://msdn.microsoft.com/en-us/library/system.net.httpwebrequest(v=vs.110).aspx原贴地址:http://stackoverflow.com/questions/9145667/how-to-post-json-to-the-servervarhttpWebRequest=(HttpWebRequest)WebRequest.Create("http://url");httpWebRequest.ContentType="text/json";httpWebRequest.Method="POST";using(varstreamWriter=newStreamWriter(httpWebRequest.GetRequestStream())){stringjson="{"data_content":"1","+""terminal_id":"2"}";streamWriter.Write(json);streamWriter.Flush();streamWriter.Close();}varhttpResponse=(HttpWebResponse)httpWebRequest.GetResponse();using(varstreamReader=newStreamReader(httpResponse.GetResponseStream())){varresult=streamReader.ReadToEnd();}