Re: [問題] jquery的cascade選單應用

看板Ajax作者 (小惡魔)時間16年前 (2008/12/21 19:34), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串5/5 (看更多)
※ 引述《appleboy46 (小惡魔)》之銘言: : $(document).ready(function() : { : $("#user_department").cascade("#user_college", { : ajax: { : type: 'GET', : url: 'ajax.php', : data: { action: 'show', val: $('#user_college').val() } : }, : template: commonTemplate, : match: commonMatch : }); : }); : 這樣就可以了,請問 cascade 只能吃 val 這個變數? : 換成其他的就不行了阿? Orz 竟然會出現這種奇怪的情形 恩 剛剛去看了一下 jquery.cascade.ext.js souce code $.ui.cascade.ext.ajax = function(opt) { var ajax = opt.ajax;//ajax options hash...not just the url return { getList: function(parent) { var _ajax = {}; var $this = $(this);//child element var defaultAjaxOptions = { type: "GET", dataType: "json", success: function(json) { $this.trigger("updateList", [json]); }, data: $.extend(_ajax.data,ajax.data,{ val: opt.getParentValue(parent) }) }; //overwrite opt.ajax with required props (json,successcallback,data) //this lets us still pass in handling the other ajax callbacks and options $.extend(_ajax,ajax,defaultAjaxOptions); $.ajax(_ajax); } }; }; 已經用了 val 這個變數了,所以難怪用其他變數去接,會沒作用,導致 ajax 失效 http://blog.wu-boy.com/2008/12/19/637/ -- Appleboy Blog: http://blog.Wu-Boy.com Appleboy Life: http://life.wu-boy.com -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.123.107.20
文章代碼(AID): #19JYdHth (Ajax)
文章代碼(AID): #19JYdHth (Ajax)