如何从jquery确认框提交php页面
How to submit the php page from jquery confirmation box?
我从jquery创建了一个确认框。我想在单击确认框中的确认按钮时提交页面并查看PHP echo消息。你能帮我输入确认按钮的代码吗?
我的jQuery/javascript函数在这里:
$(document).ready(function(){
$('#click').click(function(){
//$(function() {
// a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore!
$( "#dialog:ui-dialog" ).dialog( "destroy" );
$( "#dialog-confirm" ).dialog({
resizable: false,
height:140,
modal: true,
buttons: {
"Ok": function() {
// I WANT THE CODE FOR HERE TO SUBMIT THE PAGE TO WIEW PHP ECHO MESSAGE
},
Cancel: function() {
$( this ).dialog( "close" );
}
}
});
});
});
您可以使用jQuery Form提交库。这将给你很多选择。根据您的要求,您可以致电
beforeSubmit: 'YOUR FUNCTION To OPEN DIALOG',
如果这是真的,你的表格将得到张贴,你肯定会得到回复。请参阅此处的示例:http://malsup.com/jquery/form/#ajaxForm
使用jQuery Post函数。。。
$.post("test.php", { 'choices[]': ["Jon", "Susan"] });
这是一个在帖子完成时带有回调的版本。。。
$.post("test.php", { name: "John", time: "2pm" },
function(data) {
alert("Data Loaded: " + data);
}
);
或者,如果您有一个想要发布的现有表单,请使用jQuery提交函数。。。
$("form").submit();
但在执行此操作之前,您需要确保已填充表单中的输入字段。
试试这个代码,
var parameter_1 = 'test';
var parameter_2 = 'test';
$.ajax(
{
type: "POST",
url: "/submit_url.php",
data: "parameter_1="+ parameter_1 +"& parameter_2 ="+ parameter_2,
success: function(html)
{
alert('Submitted');
}
});
相关文章:
- 我想使用模态通过php文件发送邮件,并且我希望在提交关闭后关闭pop
- 如何从jquery确认框提交php页面
- 从 JavaScript 提交 PHP 表单
- 提交 php 表单而不刷新页面
- 提交PHP表单不会将PHP变量传递给javascript函数
- 不要在提交PHP时刷新页面
- 当用户提交PHP表单时,我如何将文本文件发送到网站上所有打开的浏览器
- JQuery按钮获取url并提交php表单
- 通过 AJAX 提交 PHP 数组不起作用
- 使用javascript自动提交PHP表单
- 自动提交php表单
- 每个输入都在表单提交PHP上序列化
- 提交PHP表单,无需重新加载或AJAX
- javascript验证成功后提交PHP表单
- 从单页提交PHP查询
- 提交php不工作
- 如何提交PHP表单数据.(不是怎么做!)
- 表单没有提交php和jquery
- 尽管未选中,但 HTML 复选框值仍提交 (PHP)
- 隐藏确认表单重新提交PHP