如果要編寫javascript和html/css UI以在瀏覽器中運行,可以使用jQuery及其ajax方法。
$(document).ready(function() {
$.get("your/restful/url/here", function(data) { // do stuff with data here});
$.post("your/restful/url/here", function(data) { // do stuff with data here});
});
你可以擴展上面甚至進一步是這樣的:
$(document).ready(function() {
$("post").click(function() {
$.post("/restful/?parm1=" + $("#input1").val() + "&parm2=" + $("#input2").val() , function(data) { // do stuff with data here});
});
});
<input type="text" id="input1" />
<input type="text" id="input2" />
<input type="submit" id="post">Post</input>
此外,作爲在評論中指出的那樣,你也可以只是簡單用瀏覽器打開你的RESTful的URL。
爲什麼你不能只使用IE瀏覽器? – 2010-03-19 17:28:28
我需要顯示從服務器獲得的XML列表,並將其顯示在比使用默認IE XML顯示獲得的原始XML顯示更好的顯示中。 – recipriversexclusion 2010-03-19 18:46:38