jQuery $ .post发布数据 [英] jquery $.post post data
问题描述
这是我的发布方法:(代码根据教程而定)
this is my post method :(Code is as per tutorial )
$.post('test.htm',{name:test_name"}, function (data) {
$('#feedback').html(data);
});
我想在test.html上附加'name'参数,然后在index.html页面上检索完整的数据
I want to append'name' parameter on test.html .and then retrieve complete data on index.html page
Test.html
Test.html
<body>
<div> welcome + //How to append name here ?? </div>
</body>
我可以通过"$_POST"
命令在php上完成此操作....在HTML页面上还有什么替代方法..
I can do it on php by "$_POST"
command .... whats the alternative of it on HTML page ..
最终数据将显示在index.htm中
Final data will be display in index.htm
<body>
<input id="button" type="submit" value="Go" />
<div id="feedback"> </div>
</body>
类似的帖子:
如何将这些数据发布到http服务器?
jQuery帖子未返回数据
jQuery帖子数据
jQuery-使用帖子数据重定向
How do I POST this data to an http server?
jQuery post not returning data
Jquery Post Data
jQuery - Redirect with post data
推荐答案
$.post
接受要传递给服务器的对象,就像这样
$.post
accepts an object to be passed to the server, like so
$.post('test.htm', {name: "test_name"}, function (data) {
$('#feedback').html(data);
});
当然,在.htm
页面中没有任何内容可以捕获请求,您将需要某种服务器端语言.
of course, in a .htm
page there is nothing to catch the request, you'll need a serverside language of some sort.
这篇关于jQuery $ .post发布数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!