Tag : chash , By : James Cary
Date : March 29 2020, 07:55 AM
I hope this helps you . I have the following case : , Post the form in a js function and pass parameters to it: function postForm(tcode, t_s)
{
$('#<%=hf_task_code.ClientID%>').val(tcode);
$('#<%=hf_trans_serial.ClientID%>').val(t_s);
$('#frm_popup').submit();
}
<a id="btnShowPopup5" runat="server" class="thickbox" href='#'
onclick='<%# "postForm(\"" + Eval("t_code") + "\",\"" + Eval("t_s") + "\")")%>' />
|
Opened multiple popup using window.open().How to make all popup stay at top and also access parent page
Date : March 29 2020, 07:55 AM
Hope this helps One way is to store the window handles in an array and call the focus method. It works in IE. It will not work in Chrome, details hereFIDDLEvar popupWindowsArr = new Array();
function popupClicked() {
var title = "Test -" + popupWindowsArr.length;
var wndID = window.open("http://www.google.com", title, "height=400,width=700");
popupWindowsArr.push(wndID);
for(var i = 0; i < popupWindowsArr.length; i++) {
popupWindowsArr[i].focus();
}
}
<asp:HiddenField ID="hdnPopupNames" runat="server" />
function popupClicked() {
var popupNames = document.getElementById('<%=hdnPopupNames.ClientID %>').value;
var wndName;
if (popupNames.length > 0) {
var namesArr = popupNames.split("|");
wndName = "Test -" + namesArr.length;
for (var i = 0; i < namesArr.length; i++) {
var wnd = window.open("", namesArr[i]);
wnd.focus();
}
popupNames += "|" + wndName;
}
else {
wndName = "Test - 0" ;
popupNames = wndName;
}
window.open("TestHTMLPage.htm", wndName, "height=400,width=700");
document.getElementById('<%=hdnPopupNames.ClientID %>').value = popupNames;
}
|
How to make popup popping up even when you moved on to another page and carry the popup data to another page?
Date : March 29 2020, 07:55 AM
To fix the issue you can do i am having a submit form in a popup and my requirement is The popup and it's data remain constant even i moved to another page, untill i submit the form data the popup should be shown on all pages with content. $("#call_log").click(function(e) {
//localStorage.timerpopup="active";
document.getElementById("test").style.display = "block";
});
$("img.close").click(function(e) {
$("#test").fadeOut();
});
#test {
background: lightgrey;
padding: 10px;
position: relative;
padding-top: 20px;
top: 100px;
width: 450px;
border: 5px solid #ddd;
}
img.close {
position: absolute;
right: 0px;
top: 0px;
height: 30px;
width: 30px;
cursor: pointer;
}
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<input type="button" value="Call log" id="call_log">
<div id="test" style="display: none;">
Submit form
<form action="save_popup_data.php" method="post">
<input type="text" name="currenturl" id="currenturl" value="12345">
<input type="text" name="starttime" id="starttime" value="3.00">
<input type="text" name="endtime" id="endtime" value="4.00">
<input type="text" name="duration_hours" id="duration_hours" value="1">
<input type="text" name="duration_minutes" id="duration_minutes" value="30">
<input type="submit" name="save" id="save" value="Save" style=" padding: 5px 15px;">
</form>
<img class="close" src="https://cdn3.iconfinder.com/data/icons/status/100/close_4-512.png" alt="">
</div>
|
Tag : php , By : Willem van Schevikho
Date : March 29 2020, 07:55 AM
To fix the issue you can do I'm trying to post data to a new window (using window.open) from a popup that was opened with the window.open method. What I'm trying to do is pass the selected option value to the newly opened window and load data using $_POST. , Modify your script like this: <script type="text/javascript">
$(document).on('click', '.openForm', function()
{
var select = $(this).data('select'),
val = $('#'+ select).val();
$.post('/path/to/page.php', {id: val}, function(res)
{
console.log(res);
var myWindow = window.open("", "MyWindow", "width=600,height=600");
myWindow.document.write(res);
//window.open('test_json.php',1,'width=600, height=600');
});
});
</script>
|
Tag : php , By : SachinJadhav
Date : December 23 2020, 03:30 PM
I wish did fix the issue. , Use e.preventDefault(); if you don't want to reload. <script>
$(document).ready(function(){
$("#contactForm").submit(function(e){
e.preventDefault();
var name = $("#name").val();
var phone_no = $("#phone_no").val();
var alt_ph_no = $("#alt_ph_no").val();
var id_card_number = $("#id_card_number").val();
var email_id = $("#email_id").val();
var address = $("#address").val();
$.ajax({
method: 'POST',
url: "<?php echo url('admin/customer_add') ?>",
async: false,
data: "&name=" + name + "&phone_no=" + phone_no + "&alt_ph_no=" + alt_ph_no + "&id_card_number=" + id_card_number + "&email_id=" + email_id + "&address=" + address + "_token=" + $('#token').val(),
success: function(result){
if (result == "success"){
alert("Done");
}
}
});
});
});
</script>
$('body').on('submit','#contactForm',function(e){
e.preventDefault();
$.ajax({
url : "{{ url('admin/customer_add') }}",
data: new FormData(this),
type: 'POST',
contentType: false,
cache: false,
processData:false,
headers: {
'X-CSRF-TOKEN': '{{ csrf_token() }}'
},
beforeSend: function(){
//loding..
},
success:function(result){
if (result == "success"){
$('#modal').modal('hide');
}
},
});
});
|