1 <Div>2 <Table>3 <TR>4 <th>State</th>5 <th>Information</th>6 </TR>7 <TR>8 <TD>00</TD>9 <TD>Display information</TD>Ten </TR> One </Table> A </Div>
<input type= "Submit" Name= "XX" value= "Submission" >
JS section:
1<script src= "Jquery.js" ></script>2<script>3$(function(){4$ (' input[name= ' xx "] '). Click (function(){5Alert (' 12 ');6$.post (' vv.php ', {a: ' yy '},function(msg) {7 varx = eval (' (' +msg+ ') ');8$.each (x,function(i,m) {9$ (' table '). Append (' <tr><td> ' +m.status+ ' </td><td> ' +m.msg+ ' </td></tr> ');Ten}), ' JSON ' One }) A }) - }) -</script>
PHP section:
1<?PHP2$a =!empty ($_post[' a '])? $_post[' A ']:0;3 if($a = = ' yy '){4$arr =Array (5Array (' status ' = = 0, ' msg ' = ' Unknown error '),6Array (' status ' = = 1, ' msg ' = = ' Unknown error 22 ')7 );8 Echo Json_encode ($arr);9 }Ten?>
ajax+php Processing Cases