Total members 11890 |It is currently Sat Apr 20, 2024 11:21 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Open popup dialog using JQuery UI , submit form using this dialog
javascript code
<html>
<head>
<title>Show popup dialog with JQuery</title>

<!--
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
Note you can download the JQuery package instead of using Google version. -->
<script src="jquery-1.8.3.js"></script>
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
<script>


$(document).ready(function(){


$( "#divPopUp" ).dialog({
autoOpen: true,
title: 'Subscribe to this webiste:',
resizable: false,
width:'400',
hide: "explode",
modal: true,
buttons: {
"Confirm": function() {

// You can post the form parameters using ajax
$("#subForm").submit();
$( this ).dialog( "close" );
},
"Cancel": function() {
$( this ).dialog( "close" );
}
}
});

});
</script>
</head>
<body>

<div id="divPopUp" style="background:#C4C4C4;color:yellow;width='100';">
<form action="subscribe.php" method="post" id="subForm">
<u><b>Subscribe to this webiste:</b></u><br>
<table>
<tr>
<td><b>Email:</b></td><td><input type="email" size="30" name="email" /><br/></td>
</tr>
<tr>
<td><b>Password:</b></td><td><input type="password" size="30" name="password" /><br/></td>
</tr>
<tr>
<td><b>Confirm Password:</b></td><td><input type="password" size="30" name="password2" /><br/></td>
</tr>
</table>
<input type="submit" value="submit" id="sbtButton" />

</form>

</div>
<button id="btn1">I do nothing</button>
</body>
</html>


To do event in case before closing the dialog , you add it like this
javascript code
$( "#divPopUp" ).dialog({
autoOpen: true,
title: 'Subscribe to this webiste:',
resizable: false,
width:'400',
hide: "explode",
modal: true,
buttons: {
"Confirm": function() {

// You can post the form parameters using ajax
$("#subForm").submit();
$( this ).dialog( "close" );
},
"Cancel": function() {
$( this ).dialog( "close" );
}

}
,
beforeClose: function (event, ui) {
alert('do something before close');
}
});


For posting parameters :
jquery-examples/post-parameters-using-jquery-t10686.html



_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time

updated


_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 2 posts ] 

  Related Posts  to : Show popup dialog using JQuery
 Show Progress Bar using JQuery     -  
 Show slider Bar using JQuery     -  
 Show Spinner using JQuery     -  
 Show Tabs Panel using JQuery     -  
 Show loading image from JQuery     -  
 Show hint when focus on html element using JQuery     -  
 Progress dialog     -  
 java confirmation dialog     -  
 Popup message without using javascript     -  
 Popup message using JavaScript without using alert function     -  



Topic Tags

JQuery UI






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com