Html code
The code is as follows: |
Copy code |
<Table width = "100%" border = "0" cellspacing = "1" cellpadding = "1" style = "margin-top: 20px;"> <Form id = "submitform" name = "submitform"> <Tr> <Td height = "40" class = "align_c"> Customer Information: </td> <Td> Name: <? = Iconv ('gbk', 'utf-8', $ rs ['buy _ name']);?>, Mobile phone: <? = $ Rs ['buy _ Tel'];?> </Td> </Tr> <Tr> <Td height = "40" class = "align_c"> customer name: </td> <Td> <label for = "textfield"> </label> <Input type = "text" name = "c_name" id = "c_name" value = "<? = Iconv ('gbk', 'utf-8', $ rs ['buy _ name']);?> "/> </Td> </Tr> <Tr> <Td height = "40" class = "align_c"> customer's phone number: </td> <Td> <input type = "text" name = "c_tel" id = "c_tel" value = "<? = $ Rs ['buy _ Tel'];?> "/> </Td> </Tr> <Tr> <Td height = "40" class = "align_c"> customer gender: </td> <Td> <Select name = "c_sex" id = "c_sex"> <Option value = "0"> Female </option> <Option value = "1"> male </option> <Option value = "2"> Unknown </option> </Select> </Td> </Tr> <Tr> <Td width = "14%" height = "40" class = "align_c"> enter the broker ID: </td> & Lt; td width = "86%" & gt; <Div class = "login"> <Input type = "text" maxlength = "128" name = "title" id = "title" placeholder = "Enter the broker id" onkeyup = "getreNews (this. value); "autocomplete =" off "/> <Input name = "agid" type = "hidden" id = "agid"/> <Input name = "id" type = "hidden" value = "<? = $ Mid;?> "/> <Ul id = "apDiv1" style = "position: absolute; left: 0px; top: 24px"> </Ul> </Div> <Span class = "liru"> Example: 138 </span> </Td> </Tr> <Tr> <Td height = "40"> & nbsp; </td> <Td> <Input name = "button" type = "button" class = "button_style" id = "ajaxsubmit" value = "start transfer"/> </Td> </Tr> </form> </Table> <Script language = "javascript"> $ ('# Ajaxsubmit'). click (function (){ Var agid = $ ("# agid"). val (); If (agid = '') { Alert ('select the ID number of the broker to be transferred first! '); Return false; } Var postData = $ ('# submitform'). serialize (); // Alert (postData ); $. Ajax ({ Type: "POST ", Url: "ajaxSave. php ", Data: postData, Success: function (msg ){ If (msg = 0 ){ Alert ('forwarding successful. You can check the status of this customer at any time! '); } Else if (msg =-2) { Alert ('The user has been transferred successfully. Please do not submit it again! '); } Else { Alert ('sorry, the system is busy. Please try again later! '+ Msg ); } } }); }) </Script>
|
In the previous section, the efficiency improvement data is saved to the database by ajaxSave. php. Let's take a look at the ajaxSave. php file.
The code is as follows: |
Copy code |
$ SQL = "insert into abctage (B _name,) value (4 )"; $ Query = $ Db-> query ($ SQL) or die (mysql_error ()); If ($ query) { Cho 0; } Else { Echo-1; } |
I simplified the above php code for loading data into the database. You can operate it according to your own situation.
This site Original tutorial conversion indicated Source http://www.111cn.net