如何動態地填充DDL列表(級聯ddl)使用jQuery的W/O毫安ajax框架或jQuery插件? (我工作的地方對我可以使用的圖書館非常有限)。我正在使用ASP.Net與jquery訪問asmx webmethod。在$就調用Web方法如下所示:級聯ddl與jquery,asmx,但不MS MS AJAX或插件
function getText() {
$.ajax({
type: "POST",
url: "SearchFilters.asmx/HelloWorld",
dataType: "html", // also tried "text"
success: function(response) {
alert(response);
$("#ddlCase").html(response);
}
});
}
這返回XML,看起來像以下:
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/"><option value='1'>Hello World</option></string>
在成功的功能,JS僅清除出的值ddl:
$("#ddlCase").html(response)
可以這樣做嗎?我怎樣才能解碼返回的XML?我錯過了什麼?以前我嘗試過一種json的數據類型,但沒有成功。請參考以下內容:
using JQuery .ajax, a Success method is not called when using jquery 'json' vs 'text'
謝謝! D