<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>红色部分以这样方式传递,很容易被捕获?是否安全
$(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>红色部分以这样方式传递,很容易被捕获?是否安全
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();
}
1.使用scriptmanager
或者
2.引用microsoftAjax.js