AJAX解析xml文件對象

xml:

<xml>

    <string xmlns="http://tempuri.org/">

        {"Flag":1,"Error":"","Result":[{"BIAOTI":"這是標題","JIANJIE":"這是內容"}]}

    </string>

</xml>

 

 

js

//解析成js  json對象。

                         $.ajax({

                                type: 'post',       //post傳值方式

                                url: "http://XXXXXX",

                                data:{key:falvfaguiid},

                                cache: false,

                                dataType:'xml',

                                contentType:"application/x-www-form-urlencoded; charset=utf-8",

                                success: function (result) { //執行成功後的額操作

                               

                                      $(result).find("string").each(function(i){

                                          

                                          var obj=$.parseJSON($(this).text());

                                                

                                    })

                                }

                            })

發佈了17 篇原創文章 · 獲贊 8 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章