( )
POST GET. POST , URL- . ( URL- , , , ).
URL , .
, - . . .
HTTP- . . . . jQuery, ...
. jQuery , JavaScript . - , JavaScript . JavaScript/jQuery, , .
: ( ASP.NET)
:
. POST, . :
- script ( )
- main script
- main script POST ( AJAX) ( )
- main script .
.
, . 3 , Google Chrome 3.0.195.38. . jquery-1.3.2.js, .
main_page.html
, . , id=sourcePageBtn.
/, POST (,). / .
<html>
<head>
<script type="text/javascript" src="jquery-1.3.2.js"></script>
</head>
<body>
<a id="sourcePageBtn" href="javascript:void(0);">click to launch popup window</a>
<script>
$(function() {
$('#sourcePageBtn').click( function() {
($(window).data('popup') && !$(window).data('popup').closed)
|| $(window).data('popup', window.open('popup.html','MyPopupWin'));
var wndPop = $(window).data('popup');
(waitAndPost = function() {
if (!wndPop || !wndPop['ready'])
setTimeout(waitAndPost, 200);
else {
$.post('process.aspx', { name: "John", time: "2pm" }, function(data) {
$('p',wndPop.document).html(data);
});
}
})();
});
});
</script>
</body>
</html>
popup.html
, . popup.html jQuery script .
"", window['ready'] = true, DOM . script , .
<html>
<head>
<script type="text/javascript" src="jquery-1.3.2.js"></script>
</head>
<body>
<p>page is loaded</p>
</body>
<script>
$(function() {
window['ready'] = true;
});
</script>
</html>
process.aspx.cs( # ASP.NET process.aspx)
script.
AJAX Page.Request.
, .
public partial class process : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
string strName = Request["name"] ?? "(no name)";
string strTime = Request["time"] ?? "(no time)";
Response.ContentType = "text/plain";
Response.Write(string.Format("{0} arrives at {1}", strName, strTime));
}
protected override void Render(System.Web.UI.HtmlTextWriter writer) {
}
}
/ .
, "[name] arrives at [time]"
: HTTP Made Really Easy, jQuery Ajax members .