Recent doubts and summary

1, the use of Ajax completion of the four steps:

  (1) Create XMLHttpRequest object (2) establish a connection to the server (3) is provided in the callback function server requests (4) after the completion of transmission

In the second step which will be used to open (), where the parameters represent the data submission (GET, POST), data submission address (URL), whether asynchronous

If GET nothing special manner, but using the POST request header to be set in the following filed i.e. normal text: xhr.setRequestHeader ( "the Type-the Context", " file application / X-WWW-formurlencoded "), and finally to the transmission data send (plus parameters) because POST data can not be displayed on the browser

2.value and val () usage scenarios

  (. 1) is generally used in the js value, to set or get text field values, are generally used getElementById the document, and then take a value or set value to obtain

  (2) val () is generally used in jq, no parameter is to get the value $ ( "input"). Val () when the parameter setup value $ ( "input"). Val ( "you stupid ..." )

Guess you like

Origin www.cnblogs.com/9797ch/p/12079230.html