<script>
$.get(url,
data,
success,
dataType);
// dataType ---text ,json,html,xml
script>
<script>
function(){
// ajax 的使用
$.ajax({
// 路径
url: "${pageContext.request.contextPath}/prod/delete.action",
//
data: {"pid": pid, "page": page, "pname": pname, "typeid": typeid, "lprice": lprice, "hprice": hprice},
type: "post",
dataType: "json",
success: function (msg) {
//
alert(msg); //弹删除是否成功
//重新读取 刷新表格
// 刷新页面http://localhost:8080/admin/product.jsp
// 表格 #table"
// $("#table").load("${pageContext.request.contextPath}/admin/product.jsp #table")
$("#table").load("http://localhost:8080/admin/product.jsp #table")
}
});
}
script>
<body>
<h3>jQuery AJAX get()方法示例h3>
<hr>
<p>暂无内容p>
<button>点击此处从服务器获取数据button>
<script>
$(
function(){
$("#btn").click(
function(){
$.get(
url,
function(data){
$("p").html(data);
}
);
}
);
}
);
script>
body>
<script>
$(
function(){
$.()
}
);
script>
<script>
$(
function(){
$.ajax(
url:,// 路径
data:{username:username,pwd:pwd},//传递的前端参数
type:post,// 请求方式
dataType:json,//数据类型:text,html,json,xml // 对象,数组 一般使用 json
success:function(param){
//
$("p").html(param);
// alert
alert("success~");
}
);
}
);
script>
向服务器端发送数据并请求,并会在以获取的数据在返回到指定元素中;
$(selector).load(url,data,callback);