ajax的常见使用方法

it2022-05-05  130

ajax的常见使用方法

一、Ajax加载外部txt到页面

源代码:

<html><head><script type="text/javascript" src="/jquery/jquery.js"></script><script type="text/javascript">$(document).ready(function(){ $("#b01").click(function(){ htmlobj=$.ajax({url:"/jquery/test1.txt",async:false}); $("#myDiv").html(htmlobj.responseText); });});</script></head><body>

<div id="myDiv"><h2>通过 AJAX 改变文本</h2></div><button id="b01" type="button">改变内容</button>

</body></html>

posted on 2014-12-02 15:16 guojianjavaweb 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/guojianjavaweb/p/4137536.html


最新回复(0)