xml| Data | refresh | No refresh this article can be used as your first example of Ajax learning textbook. No refresh technology implementation, please be sure to have the necessary conditions to use, it may cause you unnecessary trouble. Our traditional methods of submitting data are implemented by .
The method property in the tag determines that the data for the form element is sent to the server
How to package HTTP request information.
Method property can be used
Method property to send form elements to read the request collection of data
Get identity at the end of URL querystring
Post in the body of the HTTP request (the free area of the HTTP request) Form
This article uses XMLHTTP to realize the form's method=post.
Clientpost.htm
Userid:
Username:
Server.asp server-side processing.
<% @Language = "JavaScript"%>
<%
function Opendb (sdbname)
{
/*
*---------------opendb (sdbname)-----------------
* OPENDB (Sdbname)
* Function: Open database Sdbname, return conn object.
* Parameters: Sdbname, String, database name.
* Example: var conn = opendb ("Database.mdb");
*---------------opendb (sdbname)-----------------
*/
var connstr = "Provider=Microsoft.Jet.OLEDB.4.0;" Data source= "+server.mappath (sdbname);
var conn = Server.CreateObject ("ADODB.") Connection ");
Conn. Open (CONNSTR);
Return conn;
}
var sresult = "";
var oconn = opendb ("Data.mdb");
//equivalent to the method=post of form.
Equivalent to the form of the method=post.
Special characters: +,%,&,=, etc. transmission solutions. The client is transmitted over the escape code.
So the end of the receiver should be unescape decoding first.
Update:2004-6-1 12:22
Unescape (Request.Form ("userid")) ...
var userid = unescape (Request.Form ("userid"));
var username = unescape (Request.Form ("username"));
Sresult = "UserID: +userid+" \nusername: "+username+" \ n Add success. "
var sql = "Insert into users (userid,username) Values (' +userid+" ', ' "+username+ ')";
Oconn.execute (SQL);
Response.Write (Escape (Sresult));
%>
Database design
Data.mdb
Table users.
Field
ID Auto Number
UserID text
Username text
table: Users data:
ID userid Username
1 wanghr100 Administrator