function query(){ $.ajax({ type : 'get', dataType : 'html', data : null, url : 'query.php', success : function(r){ $('#result').html(r); } }); }
function insert(){ $.ajax({ type : 'post', dataType : 'html', data : 'code='+$('#std_code_input').val()+ '&name='+$('#std_name_input').val()+ '&grade='+$('#std_grade_input').val(), url : 'insert.php', success : function(){ query(); } }); } /* * $.ajax : global variable jquery * type : method type (get, post ,...) * dataType : request data type from server (html, javascript, json, ...) * data : data for send to server (pattern : data1='x'&data2='y'&data3='z'&data(n) ... or null) * url : page for request data * success : feedback function, execute when send and get data from server success * not response from server * success : function(){ * * } * response from server * success : function(r){ * execute(r); * } */
ไม่มีความคิดเห็น:
แสดงความคิดเห็น