Hi All:
I'm not sure if what I'm asking is possible (or advisable), but I'm hoping to accomplish the following (use case) that gets php to work inside of Magnific popups given php is server side:
user goes to a wordpress site with a table (am using wpdatatables plugin).
in the table are links to text, audio, video that come from a mysql table
the user clicks on a link, and a popup appears with a form (php in html) that displays data from mysql, but also allows the user to enter information into the form and submit
submitted data are put into mysql
the user returns to the table page w/o the page refreshing (wpdatatables allows the user to sort/filter/search, but if the page refreshes all of these selections are lost and my understanding from the plugin source is they don't expose session info)
I've been trying to construct this looking at various posts, and (am a newbie) my attempts either don't work or they open a new page which could be what I have to do, but I'd prefer a popup not a new page.
My code (am trying the simplest approach I can think of that only is aimed at getting php to work, does not include the mysql statements yet) is:
1) Code in table cell (wpdatatables):
a class="popup" href"#" alt="" data-content-id="#thepop6">Pop</a><html><head><script type="text/javascript">
$('a.your-link').on('click',function(e){e.preventDefault();$.ajax({type: "POST", // or POSTurl: 'myform.php',
data: {get_request_id : $(this).data('id'), // assign a data-id to thelink}, success: function(data){$.magnificPopup.open({type: 'inline',closeOnContentClick: false,items: {src: myform.php}})}});});
Hi All: I'm not sure if what I'm asking is possible (or advisable), but I'm hoping to accomplish the following (use case) that gets php to work inside of Magnific popups given php is server side:
I've been trying to construct this looking at various posts, and (am a newbie) my attempts either don't work or they open a new page which could be what I have to do, but I'd prefer a popup not a new page.
My code (am trying the simplest approach I can think of that only is aimed at getting php to work, does not include the mysql statements yet) is:
1) Code in table cell (wpdatatables):
a class="popup" href"#" alt="" data-content-id="#thepop6">Pop</a>
<html>
<head>
<script
type="text/javascript">$('a.your-link').on('click',function(e){
e.preventDefault();
$.ajax({
type: "POST", // or POST
url:
'myform.php',data: {
get_request_id : $(this).data('id'), // assign a data-id to the
link
},
success: function(data){
$.magnificPopup.open({
type: 'inline',
closeOnContentClick: false,
items: {
src: myform.php
}
})
}
});
});
</script>
</head>
<body>
<form action="http://localhost/myform.php" method="post">
<div id="thepop6" class="white-popup mfp-hide">
<a href="http://localhost/myform.php" class="simple-ajax-iframe">form</a>
</form>
</body>
</html>
2) php file (myform.php)
<html>
<head>
<title>PHP
Test</head>
<body>
<?php`` echo '<p>Hello World</p>'; ?>
</body>
</html>
I've seen examples with "callback" but am stuck. Help! Thx