Ajax读取操作xml

编辑器加载中...

//判断Array中是否存在某个值
Array.prototype.inArray = function(value)
// Returns true if the passed value is found in the 
// array.  Returns false if it is not. 
{
    var i;
    for (i = 0; i < this.length; i++) {
        if (this[i].toLowerCase() === value.toLowerCase()) {
            return true;
        }
    }
    return false;
};

//Check the url exist in config list 
//Add for dexter
function IsUrlInConfigList(url) {
    var URLColl = "";
    var URLList = "";
    var URLArray = new Array();

    $.ajax({
        url: "/Pages/ListOfPopupURL.xml",//地址
        async: false,//是否异步
        type: "GET",
        dataType: "xml",
        error: function(xdata) { alert("fail:"); },
        success: function(xdata) {
            if ($(xdata) != null) {
                if ($(xdata).find("URLList") != null) {
                    URLList = $(xdata).find("URLList");
                    if (URLList.find("URLString") != null) {
                        URLColl = URLList.find("URLString").text();
                    }
                }
            }
        }
    });

    URLArray = URLColl.split(",");
    return URLArray.inArray(url);
}

posted on 2011-08-01 09:47  张大明  阅读(196)  评论(0编辑  收藏  举报

导航