<scripttype="text/javascript"> functioncallbackFunction(result, methodName) { var html = '<ul>'; for(var i = 0; i < result.length; i++) { html += '<li>' + result[i] + '</li>'; } html += '</ul>'; document.getElementById('divCustomers').innerHTML = html; } </script>
3. 客户端页面完成展示
ps:服务端使用 w3c 的实现
1 2 3 4 5 6 7 8 9 10 11 12
<divid="divCustomers"></div> <scripttype="text/javascript"> functioncallbackFunction(result, methodName){ var html = '<ul>'; for (var i = 0; i < result.length; i++) { html += '<li>' + result[i] + '</li>'; } html += '</ul>'; document.getElementById('divCustomers').innerHTML = html; } </script> <scripttype="text/javascript"src="http://www.runoob.com/try/ajax/jsonp.php?jsoncallback=callbackFunction"></script>