Javascript jquery确认弹出表单,在单击提交后输入值
我正在尝试创建一个表单,在点击提交后,我会得到一个带有输入值的弹出窗口,用编辑和提交按钮确认。 我看到很多例子,但没有一个是准确的 谢谢你的帮助 代码如下:Javascript jquery确认弹出表单,在单击提交后输入值,javascript,jquery,html,Javascript,Jquery,Html,我正在尝试创建一个表单,在点击提交后,我会得到一个带有输入值的弹出窗口,用编辑和提交按钮确认。 我看到很多例子,但没有一个是准确的 谢谢你的帮助 代码如下: <!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script> <link rel="stylesheet" type="text/css" h
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/blitzer/jquery-ui-1.8.2.custom.css">
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<script>
$(document).ready(function(){
$("#list").click(function() {
var cun = $("#list").val();
$.ajax({
type: "POST",
url: "http://localhost/prakash/popup form/view.php",
data: {'data':cun},
success: function(data){
//redirect to id using response
//window.location.replace("http://yoursite.com/products/" + response);
$('.display').html(data);
}
});
});
});
</script>
<script>
$(document).ready(function(){
$("#add").click(function() {
var cun = $("#dis").val();
$.ajax({
type: "POST",
url: "http://localhost/prakash/popup form/add.php",
data: {'data':cun},
success: function(data){
//redirect to id using response
//window.location.replace("http://yoursite.com/products/" + response);
$('.display').html(data);
}
});
});
});
</script>
<script>
$(function(){
// jQuery UI Dialog
$('#dialog').dialog({
autoOpen: false,
width: 400,
modal: true,
resizable: false,
buttons: {
"Submit Form": function() {
document.testconfirmjq.submit();
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
$('form#testconfirmjq').submit(function(e){
e.preventDefault();
$("p#dialog-name").html($("input#name").val());
$('#dialog').dialog('open');
});
$(文档).ready(函数(){
$(“#列表”)。单击(函数(){
var chun=$(“#列表”).val();
$.ajax({
类型:“POST”,
url:“http://localhost/prakash/popup form/view.php“,
数据:{'data':cun},
成功:功能(数据){
//使用响应重定向到id
//window.location.replace(“http://yoursite.com/products/“+答复);
$('.display').html(数据);
}
});
});
});
$(文档).ready(函数(){
$(“#添加”)。单击(函数(){
var cun=$(“#dis”).val();
$.ajax({
类型:“POST”,
url:“http://localhost/prakash/popup form/add.php“,
数据:{'data':cun},
成功:功能(数据){
//使用响应重定向到id
//window.location.replace(“http://yoursite.com/products/“+答复);
$('.display').html(数据);
}
});
});
});
$(函数(){
//jQueryUI对话框
$('#dialog')。dialog({
自动打开:错误,
宽度:400,
莫代尔:是的,
可调整大小:false,
按钮:{
“提交表单”:函数(){
document.testconfirmjq.submit();
},
“取消”:函数(){
$(此).dialog(“关闭”);
}
}
});
$('form#testconfirmjq')。提交(函数(e){
e、 预防默认值();
$($p#dialog name”).html($($input#name”).val();
$('dialog')。dialog('open');
});
}))
欢迎来到我的主页
名称
年龄
城市
您输入的姓名为:
如果正确,请单击“提交表单”
要编辑,请单击“取消”。
此代码可能对您有所帮助
函数send(){
var name=document.getElementById('name')。值;
var r=确认(名称);
如果(r==true){
//应用你的功能(它将被执行)
返回true;
}否则{
返回false;
}
返回false;
}
你能发布你的代码吗?这是我的代码……在这里,我调用ajax来显示同一页面中的用户列表,它将替换表单并显示列表。所有按钮都在工作,但第一个表单中的submit不工作。我认为提交不起作用,因为我在表单操作中调用php,在表单提交中调用ajax。
</script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<h1>Welcome To My Homepage</h1>
</div>
<div align="center" data-role="main" class="ui-content">
<a href="#" id="add" data-rel="popup" class="ui-btn ui-btn-inline ui-corner-all ui-icon-check ui-btn-icon-left">Add New</a>
<a href="#" id="list" class="ui-btn ui-btn-inline ui-corner-all ui-icon-check ui-btn-icon-left">Show List</a>
</div>
<div class="display" align="center" display="inline">
<table id="dis" border="0">
<form id="testconfirmjq" method="POST" action="insert.php">
<tr><td>Name</td><td> <input type="text" name="name" id="name"></td></tr>
<tr><td>Age</td><td><input type="text" name="age" id="datepicker-13" size="30"></td></tr>
<tr><td>City</td><td> <input type="text" name="city"></td></tr>
<tr><td><input id="button" type="submit" name="send" value="Submit"></td></tr>
</form>
</table>