Jquery learning notes
After the form is submitted, the page is not refreshed, but partial refresh. Only the ID of the form to be submitted is required.
If you use GET requests, pay attention to Chinese garbled characters, jquery will first use iso8859-1 decoding, and then sent to the server, if you use post requests, the Chinese content is directly submitted to the server for resolution.
Use the jquery-1.4.2.js and jquery. Form. js plug-ins.
If you create a new JS file, add
Document. write ("<SCRIPT type = 'text/JavaScript 'src = 'jquery-1.4.2.js'> </SCRIPT>") <br/> document. write ("<SCRIPT type = 'text/JavaScript 'src = 'jquery. form. js'> </SCRIPT> ")
// Dynamic loading page <br/> // ID Display Page's container component Id2 <br/> // URL to load the page url <br/> // gop get request or post request, default get <br/> function loadpage (ID, URL, GOP) {<br/> $ ("#" + id ). addclass ("loader"); <br/> $ ("#" + id ). append ("loading ...... "); <br/> var type = (GOP =" Post "? "Post": "Get"); <br/> $. ajax ({<br/> type: type, <br/> URL: URL, <br/> cache: false, <br/> error: function () {<br/> alert ('Load page' + URL + 'error! ') <Br/>}, <br/> success: function (content) {<br/> $ ("#" + id ). empty (). append (content); <br/> $ ("#" + id ). removeclass ("loader"); <br/>}< br/> }); <br/>}</P> <p> // partial submission form <br/> function formsubmit (formid, divid, URL) {<br/> $ ('#' + formid ). submit (function () {<br/> $ (this ). ajaxsubmit ({<br/> Target: '#' + divid, <br/> URL: URL, <br/> error: function () {<br/> alert ('Load page' + URL + 'error! ') <Br/>}< br/>}); <br/> return false; <br/>}); <br/>}< br/>