去他的~ 我發現,我這三個月 jquery 的功力大增~~~ 繞來繞去的程式碼, 最近居然看得輕松愉快~  下面是,  當 form 表單送出 後, 只更新網頁部份的內容程式碼: $('#form3').submit(function() { // catch the form's submit event $.ajax({ // create an AJAX call... data: $(this).serialize(), // get the form data type: $(this).attr('method'), // GET or POST url: $(this).attr('action'), // the file to call success: function(response) { // on success.. $('#checkdiv').html(response); // update the DIV } }); return false; // cancel original event to prevent form submitting loaddivbody(,,$("#edit_no").val); }); 再機車一點~ 表單內容是上傳附件啦~ 所以必需要 form entype = multipart/form-data 也設進jquery 內. 不然上傳附件 用jquery 送可是吃不到的喔~  $('#form3').submit(function() { // catch the form's submit event $.ajax({ // create an AJAX call... data: $(this).serialize(), // get the form data type: $(this).attr('method'), // GET or POST contentType:attr( "enctype", "multipart/form-data" ), url: $(this).attr('action'), // the file to call success: function(response) { // on success.. $('#checkdiv').html(response); // update the DIV } }); return false; // cancel original event to prevent form submitting loaddivbody(,,$("#edit_no").val); });
文章標籤
全站熱搜
創作者介紹
創作者 peeress 的頭像
peeress

小鼻子小眼睛

peeress 發表在 痞客邦 留言(0) 人氣(1,273)