JQuery $post函数
来源:互联网 发布:js 日期格式化 编辑:程序博客网 时间:2024/06/07 18:57
这个函数我们可以向数据库中传递一个参数,其实也是实现了两个网页直接的数据的交换
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>
<title></title>
<script type="text/javascript">
$(document).ready(function(){
$("button").click(function(){
$.post("test.php",
{
name:"wangdenggao",
city:"xuzhou"
},
function(data,status){
alert("data: "+data+"\nStatus:"+status);
});
});
});
</script>
</head>
<body>
<button>发送一个HTTP POST请求到页面并且获取返回内容</button>
</body>
</html>
$.post()方法是通过HTTP POST 请求从服务器上请求数据
语法是:$.post(URL,data,callback)
这个地方的url规定希望的url
data是参数我们的请求的数据,和发送的数据
callback是请求功之后执行的函数
这个时候的对应的php文件是这样的:
<?php
$name = isset($_POST['name']) ? htmlspecialchars($_POST['name']) : '';
$city = isset($_POST['city']) ? htmlspecialchars($_POST['city']) : '';
echo 'Dear ' . $name;
echo 'Hope you live well in ' . $city;
?>
- JQuery之.post函数
- jQuery.post()函数
- jQuery.post()函数
- JQuery $post函数
- jQuery.post() 函数详解
- jQuery的get,post Ajax函数
- 【jQuery】Ajax函数:$.get(),$.post(),$.ajax(),$.getJSON()
- jQuery ---post()
- jquery $.post
- jquery post
- Jquery -post
- jquery.post()
- JQUERY $.post()
- jQuery中各Ajax函数:$.get(),$.post(),$.ajax(),$.getJSON()
- ssh2+jquery中post函数url请求路径
- 详细解读Jquery各Ajax函数:$.get(),$.post(),$.ajax(),$.getJSON()
- 详细解读Jquery各Ajax函数:$.get(),$.post(),$.ajax(),$.getJSON()
- 详细解读Jquery各Ajax函数:$.get(),$.post(),$.ajax(),$.getJSON()
- CSS中如何实现表格文字的换行
- LeetCode 50 Pow(x, n)(Math、Binary Search)(*)
- BZOJ2423/HAOI2010 最长公共子序列
- UVA 12506(字典树)
- leetcode:Jump Game II 【Java】
- JQuery $post函数
- 【Android】EditText获得焦点以及失去焦点
- PAT-A1029. Median (25)
- 如何实现网页点击左边的导航右边显示对应的页面?
- hdu1576 A/B 扩展欧几里德算法
- 我与即时通讯 - PC 客户端
- PAT-A1048. Find Coins (25)
- 基础练习 01字串
- POJ2485 prim算法最小生成树