<script type="text/javascript">
          $(document).ready(function () {
              $("#Button1").click(function () {
                  $.ajax({
                      type: "get",
                      url: "Test.aspx?t=test",
                      dataType: 'html',
                      success: function (data) {
                          alert("post " + data);
                      },
                      error: function () { alert('error!'); }
                  });
              });
          });
     </script>红色部分以这样方式传递,很容易被捕获?是否安全

解决方案 »

  1.   

    用不用ajax都是这样,想要安全就用https。
      

  2.   

    呵呵,https扯远了,满足一般的web通信的基本安全要求,POST就够了
    JS POST,代码示例如下,而且还是OOP风格的:var postPage;
    var displayElement;
    function pageLoad()
    {
        postPage = "postTarget.aspx";
        displayElement = $get("ResultId");
    }// This function performs a POST Web request
    // to upload information to the resource 
    // identified by the Url. 
    function PostWebRequest()
    {
        // Instantiate the WebRequest object.
        var wRequest =  new Sys.Net.WebRequest();    // Set the request Url.  
        wRequest.set_url(postPage);     // Set the request verb.
        wRequest.set_httpVerb("POST");    var body = "Message=Hello! Do you hear me?"
        wRequest.set_body(body);
        wRequest.get_headers()["Content-Length"] = body.length;
        // Set the web request completed event handler,
        // for processing return data.
        wRequest.add_completed(OnWebRequestCompleted);    // Clear the results page element.
        displayElement.innerHTML = "";    // Execute the request.
        wRequest.invoke();  
    }
      

  3.   

    使用以上代码的前提:
    1.使用scriptmanager
    或者
    2.引用microsoftAjax.js