The Methods circulating on the Internet are basically Java's kind of jsonp. The idea of ASPnet reading is similar.
Comment. xml
<? XML version = "1.0" encoding = "gb2312"?>
<Root>
<Comment>
<URL> http://image.meimumeijia.com/product_comment/2013/08/327956_201308161103132272_small.jpg </URL>
<DESC> test the function! </DESC>
</Comment>
<Comment>
<URL> http://image.meimumeijia.com/product_comment/2013/08/327956_201sdfsdf272_small.jpg </URL>
<DESC> test and test sdfs! </DESC>
</Comment>
</Root>
1. Use the comment. xml configuration file of B in Domain.
JS
Function readnewcomment (){
$. Ajax ({
URL: "/common/control/getcommenthandler. ashx ",
Cache: false,
Async: True,
Datatype: "XML ",
Type: "Get ",
Timeout: 2000,
Error: function (XML ){
Alert ("An error occurred while loading the XML file! ");
},
Success: function (XML ){
$ (XML). Find ("root"). Each (function (){
$ (This). Find ("comment"). Each (function (){
VaR url = $ (this). Children ("url"). Text ();
VaR DESC = $ (this). Children ("DESC"). Text ();
Alert (URL + "," + DESC );
})
});
}
})
}
2. Create a general handler in Domain.
Ashx
String url = @ "http://www.4inlook.cn/Product/comment.xml ";
Xmltextreader reader = new xmltextreader (URL );
Xmldocument XD = new xmldocument ();
XD. Load (Reader );
Context. response. Write (XD. innerxml );
3. Request XML in a general processing program and return the requested object to Js for processing